I'm developing a webshop, with different aspects, the first is a regular shop, and the second is a night beer service. i've searched but can't find what i am looking for;
First the night beer service is a specific category that shouldn't be ordered with the regular items (if category 'beerservice'
is in the cart, disable all other categories to be added to the cart).
This option also needs to work vice-versa (the other wat around), so if a regular item is added to the cart, the category of 'beerservice'
should be disabled to add to the cart.
I am using this answer code that I have found:
Disable shopping when an item from a specific product category is in cart in Woocommerce
That does the job partially, but it's only impossible to add multiple products from the same category, and is doesn't work vice-vera. I have replaced in this code
I also would like to add a time specific message like, 'Order ordered past TIME won't be delivered'(didn't research this) but if it isn't to much trouble.
This code will check for parent product categories, so for a defined product category, it will:
Improved code:
Code goes in function.php file of your active child theme (active theme). Tested and works.
Related: Disable shopping when an item from a specific product category is in cart in Woocommerce