Forced Maximum quantity to not exceed 1 on single gift site that skips the cart

Shopify Partner
3 0 0

We are working with a client that wants the shopper to click on a Free Gift which takes them directly to the information checkout page (Done). We did this by using the following code on the product page

 <input type="hidden" name="return_to" value="/checkout/" />


Problem: if the shopper clicks on the logo and returns to home page they can select a second gift and checkout with 2 gifts.  Looking for a code that will force the cart to never exceed qty of 1.  

Since we are skipping the cart we can not use an app. Open to suggestions.  The theme we are using is Debut.

Shopify Partner
552 67 89

@Jay_O ,

You may iterate over the cart line items to check if it contains more than 1 gift items, you can display alert and prevent checkout 


- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution

Skype : lokendra.panwar1
1 Like