Possible permalinks bug (when pre-loading carts)

5 1 6


When a customer clicks on a permalink [1] they are taken to a checkout page which asks them for contact information. This page shows (in the right hand column) that the items specified in the permalink are now in their shopping cart. The page also has two links that take them to their shopping cart page (/cart): "Cart" in the breadcrumbs near the top of the page and "Return to cart" near the bottom of the page. However, the behaviour that the customer sees when they click these cart links depends on their previous history on your site:

  1.  If a customer has never been to your shop before, or they have browsed the store but never actually put an items in their cart, they will see an empty shopping cart. Clearly this contradicts what they have just seen on the checkout page.
  2. If the customer has previously added an item to the shopping cart on your site (even if they subsequently removed all items from the cart) they will see a shopping cart which has exactly the items and quantities that were specified in the permalink, confirming what they saw on the checkout page.

In my opinion this is a bug. In case 1 above the user should see a properly loaded shopping cart.

Technical Details:

It appears the problem springs from the fact that in case 1 above the customer does not have "cart=..." and "cart_ts=..." cookies in their browser. These cookies are created when a user first adds an item to their cart. When they do this a POST request is made using the Ajax API [2] and the response sets these two cookies in the browser.

It seems that this problem could be fixed if you were to also set these cookies (if they're not already set) when a customer clicks on a permalink and you redirect them from the cart URL (e.g. /cart/1234567:1) to the checkout URL (e.g. /12121212/checkouts/05c88505f195da538ce3154cb9596f3a). Without these cookies the browser won't be able to remember the id of the cart it's looking at on the checkout page.

[1] https://help.shopify.com/en/themes/customization/cart/use-permalinks-to-preload-cart
[2] https://help.shopify.com/en/themes/development/getting-started/using-ajax-api

Shopify Expert
10037 119 1873

A permalink is specifically designed to skip the cart creation step, and create a checkout instead. So when you click back to cart, what you'd be seeing is what you skipped. It could be empty, or it could contain other items not seen in that permalink checkout.

If you need to have them in a cart, add the items to the cart with AJAX and once they are all there redirect the user to the checkout (/checkout).

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
5 1 6

Hi Jason. The behaviour you describe is not what I see. If you click on a permalink then the current shopping basket is cleared and then populated with the items in the permalink. I even tested this using a permalink example that you provided elsewhere: https://weldmongerstore.com/cart/3409421701:1

Thanks, I'll probably have to resort to using the Ajax API to accomplish what I need but it would be much cleaner to use permalinks. I need the functionality that allows the customer to change their shopping cart when they click on the permalink; hence my interest here.

5 0 1

@Rory5 Did you end up using the API to add items to the Shopify cart when using permalinks to checkout? 

It seems like an oversight on Shopify's part and I'm running into similar issues. Curious how you solved it

33 0 8

Hello - I'm trying to give users a URL so that it first clears any existing items from cart & then adds the items given in the URL to their cart. I don't want them to go to checkout due to the specific use case that I have + other cart attributes that I want users to fill


I'm able to do both of these separately by using /cart/clear & /cart/update but can't seem to find out how to do both at the same time.


I'm trying to send this URL to customers in a message so that they simply click this & their cart will now only contain these items. Also, in my use case, I dont want them to head to checkout directly but it should land on the cart page.


any help would be much appreciated!

New Member
3 0 0