# How to create a link to the checkout with a discount code applied in the Shopify store?

There are many ways to encourage customers to buy in our Shopify store. One of them is to make the shopping experience as simple as possible. Therefore, we can redirect the customer directly to the checkout with the discount code applied.

Firstly add the **Buy button** to your **Sales Channels** if you haven't already done so. You will find all the necessary information in the article on [**Adding the Buy Button sales channel**](https://help.shopify.com/en/manual/online-sales-channels/buy-button/setup). Now you can easily create a **Shopify checkout link**. Open the product's edit page to which you want to create a link. Now click **More actions** and select **Create checkout link** from the dropped-down menu.&#x20;

<figure><img src="https://3731721370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZdVZovthV0SPlgxS6Y%2Fuploads%2FisJNreUsyatn6kY18vLI%2Fshopify-create-checkout-link-personal-discount-code.png?alt=media&#x26;token=9db49637-d186-4145-9c01-fe2103c649ad" alt=""><figcaption></figcaption></figure>

Copy the created link to the clipboard. Have a look at the article on the [**checkout link**](https://help.shopify.com/en/manual/products/details/checkout-link) if you want to link several products or different variants.&#x20;

<figure><img src="https://3731721370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZdVZovthV0SPlgxS6Y%2Fuploads%2Fk0l1zgniyKH2xm0KANYD%2Fshopify-create-checkout-link-personal-discount-code-copy-to-the-clipoard.png?alt=media&#x26;token=4d12e7e4-b95a-4378-b47a-b2adfa139fab" alt=""><figcaption></figcaption></figure>

The next step is switching out to the **Personal Discount** app. You can add new automation or edit the existing one. Scroll down to the **Redirect** section. At this point, we need to modify our Shopify checkout link a bit. Personal Discount redirect creates a link that looks like this:&#x20;

<figure><img src="https://3731721370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZdVZovthV0SPlgxS6Y%2Fuploads%2FSMHwu1xBD2cOp1xnS2QB%2Fpersonal-discount-code-shopify-redirect.png?alt=media&#x26;token=a8d6c963-340e-4a7c-bba6-592a5d79dc95" alt=""><figcaption></figcaption></figure>

As we can see, there is one question mark in our link. The construction of the URL doesn't allow to use of further ones. So if there is another question mark in your checkout link, you need to remove it along with the part following it. Please look below:

<figure><img src="https://3731721370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZdVZovthV0SPlgxS6Y%2Fuploads%2FPZorzqNnu5b5cvhW0ewV%2Fpersonal-dsicount-code-shopify-redirect-link-delete-aprt.png?alt=media&#x26;token=8426e282-e191-4c89-93cc-0ca1ed96b28b" alt=""><figcaption></figcaption></figure>

And this is how you should fill out the **Redirect** section in the Personal Discount automation settings:

<figure><img src="https://3731721370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZdVZovthV0SPlgxS6Y%2Fuploads%2FQGNvnw4zOiGKk8yI3j5S%2Fpersonal-dsicount-shopify-redirect-link-delete-part.png?alt=media&#x26;token=95f4c7bc-d933-438e-96ca-aa34329dc890" alt=""><figcaption></figcaption></figure>

Select the option that you want to redirect to another page within your store and paste the proper part of the URL.

<figure><img src="https://3731721370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZdVZovthV0SPlgxS6Y%2Fuploads%2F36tZzm4RXtOpM0uSofwJ%2Fpersonal-discount-code-shopify-redirect-link-checkout-with-the-discount-applied.png?alt=media&#x26;token=f71ccfb1-8068-4819-9d3b-4400e3ff8830" alt=""><figcaption></figcaption></figure>

As a result, customers will be redirected to the checkout with the discount code applied.

<figure><img src="https://3731721370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZdVZovthV0SPlgxS6Y%2Fuploads%2FLU6pRSGg6CNNrg609eFw%2Fpersonal-discount-code-applied-checkout-link-shopify.png?alt=media&#x26;token=b946d61f-3793-40f0-b12d-19e2c15c075a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3731721370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZdVZovthV0SPlgxS6Y%2Fuploads%2F5gN4t0tMKqRbxYFdKx12%2Fshopify-personal-discount-code-applied-checkout-link.png?alt=media&#x26;token=b4e114ae-c889-4457-85b9-a434099572a5" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.personaldiscount.io/personal-discount-for-shopify/use-cases/how-to-create-a-link-to-the-checkout-with-a-discount-code-applied-in-the-shopify-store.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
