I am trying to recalculate the price of ALL the items in the shopping cart so when a specific coupon is applied a mass set discount of $50.00 off all products of a certain type is triggered.
The rule I have works, but to an extent. There seems to be glitch in the loop(s) so if I refresh the page, it will apply it to the next line item in the user's order that matches the criteria.
I currently have two rules setup:
First redeems the coupon (with specific taxonomy criteria) then adds it to this list:
The second calculates the sell price of a coupon:
data value not empty: commerce-line-item:line-item-id
Entity has value: commerce-line-item:order HAS commerce_coupon_order_reference
Line item product has terms: (list of taxonomy terms)
My actions are:
- Set the unit price to a specific amount: commerce_line_item: amount 24500 ($245.00)
- Loop: commerce-line-item:order:commerce-line-items
- Custom Message of price reduction
Currently it can count all the items when the custom message is repeated, but if I trade places with the second loop and "set the unit price" it breaks. Even after rebuilding the rule from scratch.
The coupon works, it applies to the correct items, but it doesn't calculate all the items in the order, only one at a time and applies to additional items in the order after refreshing the page.
Can anyone help me see what's wrong with the way I built this rule or suggest a way of applying a single coupon to multiple line items in the cart?