Limit purchases to only one collection?

New Member
2 0 0

Hello! I'm trying to find a way, either through an app or ideally through a simple addition of code, to prevent a customer from adding products from more than one collection to their cart. It must prevent the customer from adding an additional product to their cart if they already have a product in their cart from a different collection, and they must not be able to checkout. 

For example, I have Collection A and Collection B. A customer can add as many products as they want from Collection A. However, as soon as they try to add a product from Collection B - if they still have a product(s) from Collection A in their cart - they are prevented from doing so and receive a message as to why. If they were to remove all product from Collection A from their cart, they could then add product from Collection B.

I'm not a developer but have a basic knowledge of adding code/script. 

I will also note that my current review of apps that limit product totals etc do not offer this type of functionality. 

Any help or recommendations is GREATLY APPRECIATED.

Replies 2 (2)
Shopify Partner
4211 303 901

This isn't simple because you need to edit several templates depending on theme and do tests to prevent a checkout you dont want that has mutually exclusive products.

You can contact me at with store name and details for pricing on this customization.

Loosely the starting code for product templates:

{% assign opposingcollection == "opposingcollectionname" %}
{% assign cart_collection_conflict == false %}
{% assign current_product_first_collection == product.collections.first %}
{% assign current_product_collections ==  product.collections | join:"" %}

{% for item in cart.items %}
 {% assign current_item_collections == item.collections | join:"" %}
 {% if item.collections.first == product.collections.first %}{% continue %}{% endif %}
 {% if current_item_collections contains opposingcollection  %}
  {% assign cart_collection_conflict == true %}
 {% endif %}
{% endfor %}


Then if there's a conflict disable the add to cart and other buttons, or show a call to action.


Merchants needing product exclusion business logic can contact me at with store name and details for pricing.

Finally Combinable Discounts - EARLY ACCESS ONLY - Use Free Shipping With Other Discounts

Answers powered by coffee Buy Paul a Coffee for more answers or donate to
Problem Solved? ✔Accept and Like solutions to help future merchants
Confused? Busy? Buy a custom solution
New Member
2 0 0


Does this use case still need extra dev or is it now part of Shopify native features?
Thanks in advance!