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: https://shop.myshopify.com/cart/add?id=32527592816702&quantity=1
This URL consists of 2 important parts:
Basic Shop URL: https://shop.myshopify.com/cart/add
Parameter Configuration:
- id - this id is the product variants id. {{ variant.id }} which can only be accessed through a loop
- quantity
These 2 parameters enable you to send any product or lists of products to the cart
https://shop.myshopify.com/car...?id=32527592816702&quantity=1" class="redactor-autoparser-object">https://shop.myshopify.com/car...
Basic URL + id=variant.id&quantity=# + id=variant.id&quantity=#
As far as I’ve tested there is no limit on how many items you can pre-add to the cart.
Have fun!