Can you prevent a customer adding a product to their cart until they've added a particular item?

Hi there. Looking for help with an issue. We sell small wedding favour boxes and also sell a range of sweets to fill the favour boxes. We are trying to find a way to prevent people just ordering sweets from us and only order sweets if they order the boxes. Is there a way to prevent someone adding the sweets to their cart until they have added one of the box products? I have had a look on various forums but can’t seem to find an answer.

Thanks in advance!

Hi @TheFavourStore

Quite a bespoke issue you have here, a quick solution would be to replace the “Add To Cart” button by another that stays “Add X Item before ordering Y” and that condition would be based on the cart’s products, if the cart contains product X show the normal button, if not show the modified one.

What do you think?