Cart - Use permalinks to pre-load the cart

Community Manager
Community Manager
435 50 1185

What is a cart permalink?

A cart permalink takes your customers directly to the first page of the checkout screen with items pre-loaded into their cart.

Have you ever wanted to link directly to the Shopify checkout screen with a specific cart already loaded with items? Have you ever wanted to put a "Buy it now" button in blogs and newsletters? Have you ever wanted to provide an easy reorder link to customers? Cart permalinks are the answer.

This is what a cart permalink looks like:,70881382:1

Where 70881412 is the product variant's unique ID and 1 is the quantity.

So the format of the url is:{variant_id}:#{quantity}(,...)

Appending cart and checkout parameters

You can pre-fill any of the checkout fields, simply by appending checkout query parameters in the cart permalink URL. When appending checkout query parameters, use the following URL format:


where [email] represents any of the possible checkout fields in the form, and [shipping_address][city] shows how you can use nesting to populate child fields.

List of supported checkout parameters

You can pre-fill any of the following query parameters:

Checkout parameter Description
checkout[email] Email of the customer making the checkout.
checkout[shipping_address][first_name] Address [first_name].
checkout[shipping_address][last_name] Address [last_name].
checkout[shipping_address][address1] Address [address1].
checkout[shipping_address][address2] Address [address2].
checkout[shipping_address][city] Address [city].
checkout[shipping_address][zip] Address [zip].

Applying a discount

You can directly apply a discount to a cart permalink.

The following format applies the discount:


where test is the string value of a discount code.

Note: Notes, cart attributes, and tracking parameters can be added as query parameters as usual. If customer accounts are enabled on your website, and the user is not logged in, they will see the login page before reaching the checkout.

Adding a "Buy this" link to a blog post

  1. From your Shopify admin, go to Online Store > Blog Posts.
  2. On the Blog posts page, either add a new blog post or click on an existing blog post.
  3. In the Rich Text Editor, under the "Content" header, click the HTML button:


  4. Add your link. It should look something like this:

    <p><a href="">Buy this item</a></p>
  5. Save your changes and test it out in your store.

Adding a "Reorder" link

You can add a "reorder" link right in your theme's customers/order.liquid template for each line item in the order.


  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme you want to edit, and then click Actions > Edit code.
  3. Under the Templates folder, locate and click on customers/order.liquid to open it in the online code editor. Don't see the template? Create one by clicking the Add a new template link.
  4. In the online code editor, paste the following piece of code where you would like your link to appear:

    <a href="/cart/{{ line_item.variant_id }}:{{ line_item.quantity }}">Reorder this</a>


  5. Click Save to confirm your changes.

Conversion tracking

Wish to add some tracking info to the URL, which will then show up on the order details page in your admin, when orders come in?

Use a cart note:


Or use a cart attribute (you can have several of those):


The cart note and cart attributes are shown on the order details page under Order Note.

Or use the 'ref' parameter:


The ref value is shown as a referral code in the Conversion summary section on the order details page. Click View conversion details and then click View full sessions to view the session details page:



Sales attribution

To attribute an order to a sales channel or app, you can add an additional parameter to the permalink. You can view sales attributions in the Sales by Channel report, which shows the name of the channel or app that the customer used to place their order. Sales attributions also appear on the sidebar in your Shopify Home. You can specify a storefront access token in the cart permalink as shown in the following example:


Can I let the customer edit quantities?

You can't. Quantities cannot be edited when the customer follows a cart permalink.

Finding a variant ID

Click here to learn how to find a variant ID from within your Shopify admin.


TyW | Online Community Manager @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Replies 123 (123)
3 0 0

Hi I want to pre fill state field in checkout, how it can be done?

Shopify Expert
2 0 0

Hey all! FYI – we built an app that builds this link for you:

2 0 0

Your app looks great, can it also make the customer who gets the URL go straight to a collection (not check out). I ask this because it is hard to find a pre-loaded cart with discount AND product




Shopify Expert
2 0 0

Unfortunately, our app only works if you're sending people directly to the checkout. I'm sorry I can't be of more help, but I don't know of an easy way to pre-populate a cart with a product.

2 0 0

Hi everyone!

I have 3 things I would like to get out of this, and I feel like I'm so close! But would love some help in this area.

I want my link to:
1. Have a discount code sitting in the cart (DONE!)
2. Have the customer open a specific collection (DONE!)
3. Have a product waiting in the cart (PENDING)

With the great info that you have posted, I know how to get the product in the cart, I just don't know how I can have these all in the URL at the same time and still work.

Here is what I have so far (please note I am not a coder in anyway):

https://(domain name)/discount/(code)?redirect=/collections/(collection)

Any thoughts?


3 0 3

Can permalink attributes be used to pre-load the cart with subscription/plan products? There's an option to include a product variant id, but can we include a plan id?

10 0 2

Has this permalink solution stopped working?

Can't get any URLs, including simplest version to work...


Just goes to "Something went wrong" page.

I grabbed the product code from admin view URL of product....

Any advice greatly appreciated, thanks!

Shopify Expert
20 1 9

@Proudly try these URL's. They worked for me on your site.[39409953865883]=1




10 0 2

Worked a treat, thanks @Jesse_Meyers - so issue is, how did you end up with completely different product IDs - where do I find these?

EDIT: Looks like it's because of variant IDs?

What would I do for this site, which has a subscription (and no variants?)...

The subscription product on home page.

Thanks again!

15 0 3

When viewing the product in admin, change the URL at the top and add .xml or .json to the URL

(ie change /admin/products/xxxxxx to /admin/products/xxxxxx.xml)

Then just scroll down and find the variant id.

3 0 2

So does anyone know if there a permalink that can access the "ship" vs "pick up" option? I would just really like to change which option in selected on the checkout page load based on some things they do at the cart level.

15 0 2

Awesome, this information is really useful.

There is only one thing missing that I haven't been able to figure out:

Besides notes, referrals etc. is there any way to add a tag to the permalink as well?


That would really help me a lot. Any idea how to do that?

I need a tag (or similar) which I can use as a parameter to filter for in the full order list. See also my thread about this question here:

Shopify Expert
85 0 53

Great minds think alike! 🙂 This is a feature we are actively working on over here at ZipLinks where you will be able to specify one, or more, tags to apply to an order that was completed using one of your defined links. Happy to reach out with a DM when that feature is available. 

Happy to hear about your crazy ideas.
15 0 3

Not sure if there is a way to do tag or note, but you could use ref= and retrieve that from the order later under the landing-site-ref parameter in the xml or json.

1 0 2

Personally, I just get the "Link expired: Link no longer exists" page, every time. Not sure what I'm doing wrong there. 

15 0 2

Does this whole process really only work with variants?

What if my product doesn't have variants? How do I preload my cart with a product ID (instead of variant ID) instead?

15 0 3

Every product has at least one variant id. Add .xml to the end of the product URL and you can see the variantid.

1 0 0

Would be very useful if we could include the Selling Plan for subscription products. Is there a way to do that today?

5 0 1

I was able to do this by adding the selling plan after the product id - so like this:[productid]&selling_plan=[sellingplanid]&quantity=1

I found the selling plan id by adding the product to the cart and then clicking on it and checking the URL. I'm sure there is an easier way!

1 0 0

I add this link (for white glove assembly service) with variant ID to the shipping page and it works fine, however if I add a product before clicking the link it empties the cart.

So clicking on the  "permalinks to pre-load the cart" after adding a product to the cart, deletes items currently in cart. 

Anyone have a workaround here, or am I missing something?

Shopify Expert
20 1 9

There are different URL formats referenced in this thread. Some of them will replace the contents of the cart and some of them will just modify the existing cart. Which version did you use?

15 0 2

Has there been any change in Shopify?

Since Monday or Tuesday my notes (&note=XYZ) aren't attached to the orders anymore. I'm using a link like this:

The note (in this case "google") won't be displayed in my orders. I have not made any changes to my links.

Has anyone else noticed this problem and/or found a solution?

Shopify Partner
4 0 1

How can I add rag to that orders? Maybe there should be a parameter for that?

Shopify Partner
15 0 3

I wanted to give another mention for the app ZipLinks:


One of my biggest clients is running a big radio campaign and we were able to use that app to make a short link that applied the coupon, added item to cart, tagged customer, and tagged the order.  The tagging was essential so client could judge the ROI of radio campaign.  

Alexis Priddy
Shopify Expert
216 1 34

In our app, you can build pre-filled cart links with/without discounts attached (or gifts or custom deals attached). This might help some merchant. See our demo store.


2022-03-30 10_37_50-Automatic Discount - Shopify App by Tabarnapp, Shopify Experts.png2022-03-30 10_39_44-Discount link + Pre-filled cart – Automatic Discount.png

Shopify Partner
1 0 0

Hi all! 

Just wanted to know if this is still working? It leads to an error in most of the stores we're part of. 

For example:,201493351170100:1

Shopify Expert
20 1 9

Hi Paula, you need to use the variant id, not the product id.
Try this link

11 1 1


Does anyone know how updating the input on the checkout page can work with Online Store 2.0 themes?


E.g. this works with a vintage theme e.g. Debut[shipping_address][address1...

But this does not work for a new theme e.g. Dawn

It partially works by redirecting to the checkout page and populating the product, but not the address.






Shopify Expert
20 1 9

Hi @Martin-NZPost both of your example shops are unavailable but if you test with the Shopify Dawn theme demo then you can see it does work on Dawn so it is likely something else going on with your test shops.

Try the link below to see that it does work with Dawn as the theme should have no impact on this behavior.[shipping_address][address1]=Martin%20St
Shopify Partner
2 0 0

Is it possible to use cart permalinks with Discount Combinations?


I've tried comma seperating the discount codes like the products as well as specifying the discount query parameter multiple times, but neither combination appears to work...

5 0 1

Why can't I pass in a state code in the URL?  

Shopify Partner
37 0 13

Great guide!

Is there a way to do the same with abandoned cart URLs?

This is how an abandoned cart URL looks like:

Now I want to use `notes` or `ref` params to know where the cart was recovered from, but both the params don't show on the orders page 😞

Founder |
Feel free to reach out to me at or @rohanrajpal98 on Twitter
2 0 2

Right now this doesn't work for checkout page with URL "checkouts/c/".[email]=somebody@st...

2 0 1

I've been trying to get this to work for the longest time ever, and still I keep getting an error page saying "Link expired". 

What's going on here? I'm trying to add my product to my cart automatically: