Vote up!
Vote down!

Avoiding Double Discounts

I currently have rules in place to apply a 10% discount if the order total is above a certain threshold, I now need to deal with already discounted items. By that I mean if a product has already been discounted then do not include this when calculating if a 10% discount should be applied. This is what I am trying to achieve in rules:-

When triggered to calculate sell price off a product:-

Add variable to track a total (running total)
Loop through the line items and check state of the discount field (custom boolean field)
If discount is false then add line item amount to variable (running total)
If discount is true then do nothing

Then loop through line items again
If running total is above threshold and item is not discounted then apply 10% discount
If not then do nothing

I am sure this is possible but I can not work our what combination of components to use. Anybody got any ideas?

Asked by: andyhazlewood
on June 12, 2012


I'm using Commerce Discount, and I am trying to follow the method explained in first answer.
The problem is i could not find a filed named field_discount. The only fields I found are "commerce_discounts" and "commerce_discount_offer"
When I use any of those in "Entity has field" then I add condition of "Data is empty", I could not see them data Selector.
Would you please tell me what should I do?

- massoud on January 12, 2014

3 Answers

Vote up!
Vote down!

I'm using Commerce Coupon which adds 10% discount to every item in the cart when the coupon code is entered in the checkout process. In addition i'm using custom rule that lowers the base price of products (as value discount) based on $ value field added to my commerce product type.

To avoid double discount in those products witch have discount field filled I modified the coupon pricing rule like that:

- added condition: Entity [commerce-line-item] has field: commerce_product
- added condition: Entity [commerce-line-item:commerce-product], has field: field_discount
- added condition: Data is empty [commerce-line-item:commerce-product:field-discount]

This worked for me very well. I don't know if this helps you or you have this working by now but maybe someone else could benefit from that.

Answer by: Anonymous (not verified)
Posted: Jun 27, 2012
Vote up!
Vote down!

There is a "Negate" (checkbox) option available to some of the Commerce Rules.

Answer by: Chris Charlton
Posted: Jun 23, 2012
Vote up!
Vote down!

Could somebody explain it how to achive the subject of this post? Method from the answer not working. I've spend all day trying do something with rules.
It's really important for project that i'm woring on, when i can't be able to do it i will have to change commerce for something else.
I will be very thankful for any answer!

Answer by: Adam Bińkowski
Posted: Apr 3, 2014