How to Limit add on items based on type of product and qty of each product in cart

1 0 0

Good evening


Is there a way in Shopify or an app that would allow me to restrict the type/qty of certain products that can be put in the cart based on the type of other products/qty of products that are already in the cart?


I am sure I am making this far more difficult than it needs to be but here is some background information first.


-We sell Frozen goods and Non frozen goods

-We sell both online and in 2 physical stores

-Our postal products go via DPD next day delivery and 98% of orders are frozen goods and must be packed into freezer boxes.

-The prices shown on our website for frozen postal goods already include P&P whereas dried goods purchased without frozen food have P&P added at checkout because they can go in a bag rather than a costly freezer box.

-Currently we let the customers buy whatever they want and then refund them for anything that we cannot fit into the boxes, relying on them to read the information on the product of what we can and cannot fit - very messy I know which is why I am starting over

-Our pickup items are much cheaper as they come in a different format, they do not require freezer boxes, so essentially the online price is the collection price with the P&P added already.


The obvious solution may be to put all the prices the same and add a delivery cost at checkout for postal items but we have done this in the past and sales decreased massively because the P&P is a large proportion of the total price so we found that including P&P in the price with no extra delivery costs worked much better as we are cheaper than most other suppliers even including delivery.


For example this is what I need to do


Product Type A = Box of FROZEN goods with room for a limited QTY of add on items

Product Type B = FROZEN goods with no room for ADD ON Items


ADD ON type F = FROZEN Add on item

ADD On type D = Dry Add on Items


If the customer has Product Type A in their basket, I want to allow them to add up to 2 x ADD ON type F per Product A. So if they have 2 x Product A then they can add 4 x ADD ON F, with 3 x Product A they can add 6 x ADD ON F and so on


However, if the customer has Product Type B in their basket, I want to prevent the customer from adding any ADD ON Type F because they will not fit in the box. There is no use implementing an

extra delivery charge because we cannot send any less than 8 x ADD ON F in a box and we already advertise this product with delivery already costed in so it is a product not an add on.


If customers add any more than 2kgs of ADD ON Type D (Dried Goods) per Product type A or any QTY of ADD ON Type D with Product type B then I want to implement a shipping charge for the extra box required for the surplus items.


I have no idea if that will make sense to anyone as it's taken me half an hour to write it so it makes sense to me but if you can help me in any way please do before I go insane!


I managed to sort of make it do what I wanted by using the discount option whereby a customer can buy 2 of ADD ON F per each product type A but I don't want to discount the price or mark it as free.


I feel I'm so close yet so far from the solution



Replies 3 (3)

Shopify Partner
6273 572 1309


This is cart exclusions an advanced theme customization for the online sales channel.

I build customizations like this all the time, generally for pre-orders to not be mixed with non-preorders but it's the same idea though a bit tricker when it's not black&white and the conditions can interweave.

If you need this customization service, or consulting, you can contact me directly for estimates.
Please provide context: store url, theme name, post url and any further detail. Contact Info in signature.


@TheyLoveIt wrote:

 taken me half an hour to write it 

Beating opportunity costs and defining automation can have a steeeEEp upfront stress , time , and cost for big long term gains.

Basically ballpark how much time(  per day , week, month, qaurterly, yearly) is being spent on the domino effects of this then multiply/ratio it against what more valuable thing could be done with that time and the loss that represents ---> anything under that is the budget to fix it and whether it's worth spending time precisely documenting the problem.

Generally  start with the most common denominator, biggest mistake,  customers are making that you have to spend time fixing, when time starts being recouped shave down the smaller issues.

Sounds like frozen goods would be the biggest pain.

Specifically for issues like this it can help to sit down with some index cards and go over it like your designing a board game where you define the steps, the resource type names, costs, and the counters/conditions etc.
It's either that or make an evidence board /  mystery board


@TheyLoveIt wrote:


If customers add any more than 2kgs of ADD ON Type D (Dried Goods) per Product type A or any QTY of ADD ON Type D with Product type B then I want to implement a shipping charge for the extra box required for the surplus items.

Either that "shipping charge" is:

A) a literal product added to the cart at the set cost through a theme customization*

B) inverse volume pricing - swap Type D for Type D+ which has a higher price when a threshold is met.

C) an app is needed to either create custom shipping rates or split the order into two separate payment orders

D) use the massive weight trick to trigger a high weight shipping rate of a specific fee. thoroughly test if doing this.


Sometimes entire things like this can be managed solely through theme logic and backend data setup to match.

Other times some sort of automation service or app may be needed to facilitate parts.


One route is the addon types are made into either variants , or line item properties on the main item types so the addons are baked into the main product. 

Or just completely presented as premade bundles, no thinking no navigating through the store just pick one and add em all to the cart. Optionaly using 



In some situations two stores with backend sync setup can be is the fasted cleanest way to cut this type of Gordian knot at least in terms of keeping the customer experience better divided and lower the labor of having to fix orders and tighten the communication loop with customers.

More necessary if products are sold multi-channel and the store is not a Shopify-Plus plan, because customers are going right to checkout with an invalid cart of mixed incompatible items.

If multi-channel and not Plus then you also probably need backend order validation and editing setup.


There are upcoming features things like cart validation, fulfillment constraints , order routing,  that may aid cases like this in the future but I wouldn't hold my breath for it.


*see gift wrapping tutorial as a starting point


Save time & money ,Ask Questions The Smart Way

Confused? Busy? Get the solution you need

Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to

Shopify Partner
1577 138 168

hi @TheyLoveIt 


Don't know whether you are still looking for the solution. Please refer to the below video we did for a few websites.



Let me know if it fits for you logic can be modified based on your requirements.


For any custom development WhatsApp or connect at Email ID: for quick consultation. | YouTube Videos
To support Buy Me a Coffee

374 9 28

Hi @TheyLoveIt,

You should consider exploring Easify Product Options app for configuring your product options with conditional logic 🤗.

Here's an example:




App Settings:




Given the complexity of your requirements, my suggestions may not cover all aspects. Please review and provide additional details for a more tailored solution.

Easify Product Options: Create custom product options 10X faster & easier!
Easify Product Attachments: Effortlessly add downloadable PDF files (or any other format) to Shopify pages!
Try for Free | 24/7 Live Chat Support