Comparing product variations before add to basket

I have a product variation called delivery slot which has 2 option, standard and pre-noon.

If somebody chooses standard for one product and add to basket. I would like to make sure that the next product they choose can’t have pre-noon.

So at the point of adding to basket, I would like an error to show up to say you can’t add that product with a different delivery slot.

In theory, I need a combination of getting the variations that exist for the product in the basket and using the woocommerce_add_to_cart_validation hook to validate against the variations of the product being added.

Thank You

Haris

Read more here: Comparing product variations before add to basket

Leave a Reply

Your email address will not be published. Required fields are marked *