Have you ever wanted to share a link to your Shopify store that puts items in your cart and starts the checkout, but found that if the user already had items in their cart they end up with the wrong quantity or more items than you wanted.
This is a very common trick for Shopify owners that are looking to share a link via WhatsApp, Messenger, SMS, etc.
It turns out it’s very easy to do by utilizing a combination of special Shopify URLs and parameters.
Here’s an example:
https://mywebsite.myshopify.com/cart/clear?return_to=/cart/update?updates[123456789]=1
The first part is a special URL that clears the cart. Then you add a special parameter, return_to, which allows you to specify another URL. The value for the parameter is another special URL in which you can add product variant IDs and a quantity.
Put it all together and you end up with a cart that only has exactly what you want and gets the customer straight to the checkout.
I found this solution along with many others in the Shopify Forums
Leave a Reply
You must be logged in to post a comment.