How to limit only 1 item allowed in checkout

jamesppark
New Member
8 0 0

Hi There,

I have a subscription-based product on Shopify. Subscriptions should only be 1 per customer.

 

Is there any way to prevent customers from adding more than 1 item to the checkout bag? I want it so customers can only have 1 item allowed in their checkout process and cannot add any more.

I have a variety of different subscriptions. I am using Limit Quantity Purchase so customers cannot buy more than 1 quantity of a subscription. However, customers can still add more than 1 variety of subscriptions to the checkout order, which is what I want to avoid.

 

I hope this makes sense and please advise any solutions!

 

Thanks,

Replies 2 (2)

neeravmakwana
Shopify Partner
164 30 40

Hi, can you please modify your cart.liquid file as below:

Find something like <button type="submit" name="checkout" class="btn cart__checkout">. It could be phrased slightly differently depending on the theme you are using, but you are looking for the checkout and the additional checkout button here.

You then need to make the checkout button(s) in the cart conditional. If item count is greater than 1, show a warning (but not the checkout button). Else, show the checkout butt0n.

If this does not work, please let me know. Thanks.

 

{% if cart.item_count > 1 %}
<p>You can't have more than 1 item in your cart</p>
{% else %}<button type="submit" name="checkout" class="btn cart__checkout">
{{ 'cart.general.checkout' | t }} <span class="icon icon-arrow-right" aria-hidden="true"></span>
</button>

{% endif %}

 

Shop-Finders
Tourist
4 0 1

Hi Neeravamakwana, I tried your code but, it shows me with this error.

ShopFinders_0-1710851331247.png


Can you please help me with this? Thank you!