Skip to content

Shopify 1-Click Add to Cart, the Easy Way


Allowing customers to add a similar or related product to their cart from a product page on a Shopify site can easily be accomplished using URL parameters.

The idea behind adding a product with 1-click — versus forcing the customer to visit another PDP on a Shopify site — came from similar customer expectations around relative products... the basic “Users who bought … also got ...”

Sometimes you don’t need to send them to a different PDP; for example:

  • You are selling those new shoes that everyone likes, but the trending laces aren’t included. There is no need to show a complete PDP of laces.
  • You are bundling a set of items for a discount, add all those with 1 click.

After some research, all I got was a “Permalink that adds an item to the cart, then takes straight to checkout” community post that didn't explain thoroughly how to actually get the required information from your site.

Understanding the URL

The usual 1 click add to cart URL looks like this:

This URL consists of 2 important parts:

Basic Shop URL:

Parameter Configuration:

  • id - this id is the product variants id. {{ }} which can only be accessed through a loop
{% for variant_stock in product.variants %}
{{variant_stock.title}} => {{ }}
{% endfor %}

Which by the end of this, you don’t even know which one is which. Or if you know exactly the variant index in the array {{variant[0].id}}
  • quantity

These 2 parameters enable you to send any product or lists of products to the cart" class="redactor-autoparser-object">

Basic URL + +

As far as I’ve tested there is no limit on how many items you can pre-add to the cart.

Have fun!

Blog & Events

Featured Work