Complex variant check before add to cart

1plaintext
Shopify Partner
1 0 0

One of my products requires complex variant checks. For example, when option1 value3 is chosen, it cannot allow option 2 value4 or option3 value5, etc, and there are many of these rules I need to implement. Since this is client side, I would imagine I need to do it with javascript rather than liquid.

My issue is, I need to run my check when the user "adds to cart" or "buys it now". My questions are:

1. How would I trigger a javascript call back from those actions (add to cart or buy it now)?

2a. I would not want to disallow the order, just "flag" it (any way is fine, e.g. a note in the order)... is there a way for me to on top of the variant, add a text to this order?

2b. Alternative to product variant, I can just create my own options on the page itself using javascript, but again, is there a way for me to propagate the selection to the order object? (e.g. add information to the POST body of "add" and somehow handle it?)

 

Thanks, any suggestions/pointers will be appreciated

Replies 0 (0)