Make "Add to cart" go straight to checkout

Make "Add to cart" go straight to checkout

viral1
Tourist
5 0 1

Id like it so that when people click on add to cart, they would then be redirected directly to the checkout page. Is this a good idea for a one product store? Im thinking it would provide less friction. 

P.S - Im using the refresh theme

Replies 3 (3)

noiseymur
Shopify Partner
20 2 8

If you sell only a few different products and they're not very related to each other, or you don't need the customer to purchase multiple items at once, then redirecting the customer directly to the checkout can be a good idea to reduce the friction as you said. Nothing wrong with that.

You can achieve it by making the add to cart button an anchor tag and setting the href property to this:

https://{SHOP}.myshopify.com/cart/clear?return_to=/cart/add?items[][id]={VARIANT_ID}%26items[][quantity]={QUANTITY}%26items[][selling_plan]={SELLING_PLAN_ID}%26return_to=/checkout


Replace SHOP with your shop url, VARIANT_ID with the ID of the selected product variant, QUANTITY with selected quantity. SELLING_PLAN_ID is for when you want to sell the item as a subscription. If you're not, then you can remove the:

items[][selling_plan]={SELLING_PLAN_ID}%26

 

 

AndBrouill
Tourist
11 0 1

Is there a way to do this for a store with more items? Can you give me a code for doing this for collections instead of individual products? 

tgg-mholland
Shopify Partner
2 0 0

This doesn't appear to work with selling_plan. When redirected Shopify will show the error "expected String to be a Integer: selling_plan: expected String to be a Integer: selling_plan"