I’ve built a shopping cart as above but I’m getting stuck adding a promo code.
A promo needs to look through the promo codes I have created, see what products it should be applied to (I have a product list in the admin as you can see below) then apply the relevant discount to each line item in the cart (line items store the current cart database with products in each one and I’ve add ed the field to that to make the calculations.
SO When someone hits apply, I want the workflow to look at each line item in the cart, if there’s a match, perform the calculation and update the line item with the correct discounts - which can then be displayed and calculated as a total. I just don’t know how to do this on the front end (although I’m guessing make changes to a list of things?).
There are so many ways to do this but I’m wondering what the most efficient might be?