Using the Craft 3 and Commerce 2 APIs, how would one go about looping through products in the cart to apply adjusters, looking at the following example;
A category, "Product Packs" is set up where different "packs" for products are defined. In a product, the variants have a field where one can optionally add that category. If we then have a pack, named "summer kit" in that category applied to a couple of variants of a T-Shirt product, to one variant of a Pants product, and a couple of variants of a Sweatshirt product.
How would one go about looping over those products in the cart, check for the associated category, make sure it's the same category, and only applicable to 1 t-shirt, 1 pair of pants and 1 sweatshirt, while still being able to apply it again over another set of the same product variants? So if you had 1 white t-shirt, 1 red t-shirt, 2 pairs of pants and 2 different style sweatshirts, you end up with the pack discount for both those "kits", individually.
Are there any resources with examples of similar functionality, perhaps? Any hint is helpful, I'm a bit at a loss with the PHP/API side of Craft/Commerce.