I've got a module set up to add discounts based on criteria defined in a category group (handle 'productPacks') -> category (which is a "pack").
Now, everything works great for one type of pack, and subsequent counts on that single pack, but as soon as there's other parts in the cart that correspond to other packs from the category group, no discounts are applied. I'm missing some logic in the code for how to distinguish and override a more expensive pack based on related products and which variants of that product are allowed to apply the larger discount based on said criteria.
I can't seem to get it to work so that each category is pushed as an adjustment into the adjustments array.
What am I missing? I'm checking cart contents against a category’s "related products" commerce product field (handle 'relatedProducts'), and then against which variants in those products are allowed (a commerce variants field with handle 'productVariants');
I'm simply checking the contents of the cart against the contents of a products field and a variants field in a set of categories in a specific category group. So no real relational stuff, simply comparing things to apply a discount amount that is a simple number field on the category it finds inside the specific category group (with the handle 'productPacks').