This has happened 3 times now. I'm using Rules to add a % discount on all products. I'm using Commerce Price Savings Formatter module to display the savings neatly. In the last 6 months we've noticed that 3 times already the discounted price was listed as the original price and then it adds the discount on top of that...We've lost quite a bit of money already through this. The 3 times we've notice it, it wasn't on all the products, just on one product, and only one product variation...it's digital downloadably products. But everytime it was a different product, so I can't see any correlation here except that perhaps Commerce Price Savings Formatter module might be buggy or the problem comes in through my product variations?

Any help is appreciated!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rszrama’s picture

Project: Commerce Core » Commerce Price Savings Formatter
Version: 7.x-1.8 » 7.x-1.x-dev
Component: Product pricing » Code
Category: bug » support
Priority: Major » Normal

Gonna need some more information on your configuration here; how exactly are you using the price savings formatter and how are your product pricing rules configured? Screenshots would be helpful.

recrit’s picture

A price formatter does not actually change the price of the product. It's simply a display of the price components from resolved from the pricing rules. So this sounds like your pricing rules are misconfigured.

hmartens’s picture

Thanks guys, I thought that it might not be this module but I posted it under commerce as well :) because I don't know who could be the culprit. It's not a consistent problem...it only popped up 3 times so far, and not to all the products, just one variation on one product...

Here are 3 screenshots of my rule that I've always been using. Thanks for the help!

rszrama’s picture

@recrit Yeah, I just didn't know if maybe it was only showing an incorrect discount but actually recording the correct price.

@hmartens Is that the 40% discount rule? Because multiplying by .7 is a 30% discount. Also, since there are no conditions on this rule, I don't know of any reason for it to provide an incorrect discount only some of the time.

Might be we just need to close this out or postpone it until we can actually see a reproducible behavior. Then we could determine the location of the problem (display vs. data) and actually figure out what's causing the behavior. Until then, there isn't much we can do at the module level.

hmartens’s picture

Hi Ryan. I know it says 40% in the title but every month we just update the percentage and not the title ;)

This problem seems to happen more frequently now...and it's bad...because a product that costs $75 before discount, is now dropping down to $15.80 after discount...randomly...

I checked again the products that have changed by itself, and I see they have a couple of revisions....but I can click on the revisions? And we've never made a revision either... I see the products that this problem doesn't happen to doesn't have any revisions...so maybe therein lies the problem/bug?.

In the store my client is selling a couple of formats for each design, and this problem only always happens on the default format, not any of the other formats...

I don't know how the revisions tie into this whole problem? I've attached a screenshot of the revisions for this one product and I've attached a screenshot of the setting for revisions on the product...

Thanks for the help ;)

hmartens’s picture

Hi Ryan and recrit. I just want to confirm this one setting under my Rules for the % discount on all products... ~Attached I've added a screenshot of a setting of the "PRICE COMPONENT TYPE" , it's always been set on "Discount"...Should it not be set on Base Price or what does this setting do?

Thank you for your help.

rszrama’s picture

The price component you choose shouldn't matter. In your case I'd leave it Discount and change the rounding method to round down. Revisions shouldn't have any bearing on this, either. It doesn't look like the one discount is getting applied multiple times, because I can't turn $75 into $15.80 with any successive discounts.

Can you confirm, perhaps with a masked screenshot of an order page, that the final line item total and order total are off and not just the displayed price on the product page? And is there any way for you to reproduce this behavior yourself? Ultimately I think you need to turn on Rules logging and see what happens when you reproduce the issue.

In any event, it doesn't sound like this is the result of Price Savings Formatter or Commerce itself; sure you don't have custom code in here?

hmartens’s picture

Hi Ryan, thank you for taking the time to help me with this. Attached I've added a screenshot of the final order of one of the moments that this error happened. The sets are $78 . You get 45% discount. Now what sometimes happened and what happened here was that the price before discount changed on itself to the price after discount which is roughly $35. Then it adds the 45% discount on that and the sell price comes to roughly $15. So that's what happens. And it doesn't just do it for the one sale, it physically changes the price on the product itself, but only for the default variation.

I've got no custom code change in here and this website has been running for over a year with no problems. All I can think of is perhaps that an error came in with one of the Commerce updates lately?

Unfortunately I cannot reproduce this...it just happens randomly...

hmartens’s picture

It's happening often now...it seems it's happening to only one of the taxonomy categories and not the other categories... Also, I've got this rule in the paypal which shouldn't do anything to the price change...it checks if something is less than ten cents, it doesn't send it to the payment gateway..it's for my free products. Attached is a screenshot.

I've just switched on debugging on rules now, so I hope it picks it up. Will it list it in the normal reports or is there somewhere else I must go look for the debugging reports?

I've also attached a list of all the rules I'm using on the website...I think all of them is standard builtin rules.

I'm also using LoginToboggan...that couldn't cause price change?

Thank you for your help! Much appreciated :)

Jason Ruyle’s picture

Issue summary: View changes

We are having the same issue.
Our situation is that is does change the actual price of the product, not just how it displays.
We are having the same type of calculated changes as described here:

The sets are $78 . You get 45% discount. Now what sometimes happened and what happened here was that the price before discount changed on itself to the price after discount which is roughly $35. Then it adds the 45% discount on that and the sell price comes to roughly $15. So that's what happens

We've run single and multiple % discounts, both times this situation happens. What is strange is it does change randomly. It does happen on a single product variation, even if there are multiple. I can't confirm right now if its always the default.

DigitalFrontiersMedia’s picture

I'm seeing this as well using commerce_conditions, rules_conditional, and a few PHP inputs to set up some price breaks for a manually created price table since commerce_price_table just wasn't a manageable solution for our use-case or client. The Rule is somehow changing the actual entered base price value on the price field of the product variation when the variation is saved. I can open an existing variation and set its price to $16.50, save it, and immediately re-open it to edit it, and the default value that loads in the price field will now show up as $1.06.

I've confirmed that it's the Rule doing this by simply disabling the Rule and repeating the above procedure to confirm the price does NOT change when the Rule is disabled.

My Rule is below and it appears to only attempt to alter commerce_line_item prices; I can see no evidence of it attempting to change commerce_product:commerce_price field, etc. Any chance that someone has an idea as to what is going on here? This price table and computing it is pretty vital.

Pricebreak Rule:

{ "rules_pricebreak_1" : {
    "LABEL" : "Pricebreak 1",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "-9",
    "OWNER" : "rules",
    "REQUIRES" : [
      "commerce_conditions",
      "rules_conditional",
      "commerce_line_item",
      "rules",
      "php",
      "commerce_product_reference"
    ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "IF" : [
      { "commerce_conditions_rules_condition_has_terms" : {
          "line_item" : [ "commerce-line-item" ],
          "field_name" : "field_material",
          "term_ids" : { "value" : { "189" : "189", "223" : "223", "225" : "225" } },
          "require_all" : "0"
        }
      }
    ],
    "DO" : [
      { "CONDITIONAL" : [
          {
            "IF" : { "php_eval" : { "code" : "return ([commerce-line-item:quantity] \u003E= 5 \u0026\u0026 [commerce-line-item:quantity] \u003C= 24);" } },
            "DO" : [
              { "commerce_line_item_unit_price_multiply" : {
                  "commerce_line_item" : [ "commerce_line_item" ],
                  "amount" : "0.65",
                  "component_name" : "base_price",
                  "round_mode" : "1"
                }
              }
            ]
          },
          {
            "ELSE IF" : { "php_eval" : { "code" : "return ([commerce-line-item:quantity] \u003E= 25 \u0026\u0026 [commerce-line-item:quantity] \u003C= 49);" } },
            "DO" : [
              { "commerce_line_item_unit_price_multiply" : {
                  "commerce_line_item" : [ "commerce_line_item" ],
                  "amount" : "0.55",
                  "component_name" : "base_price",
                  "round_mode" : "1"
                }
              }
            ]
          },
          {
            "ELSE IF" : { "php_eval" : { "code" : "return ([commerce-line-item:quantity] \u003E= 50 \u0026\u0026 [commerce-line-item:quantity] \u003C= 99);" } },
            "DO" : [
              { "commerce_line_item_unit_price_multiply" : {
                  "commerce_line_item" : [ "commerce_line_item" ],
                  "amount" : "0.45",
                  "component_name" : "base_price",
                  "round_mode" : "1"
                }
              }
            ]
          },
          {
            "ELSE IF" : { "php_eval" : { "code" : "return ([commerce-line-item:quantity] \u003E= 100);" } },
            "DO" : [
              { "commerce_line_item_unit_price_multiply" : {
                  "commerce_line_item" : [ "commerce_line_item" ],
                  "amount" : "0.40",
                  "component_name" : "base_price",
                  "round_mode" : "1"
                }
              }
            ]
          }
        ]
      }
    ]
  }
}