If a bug, provide steps to reproduce it

1. Clean install, only make sure variation price is calculated, not default
2. Add product 1 (price $30)
3. Create first promotion "50% Off Prod 1" (Include the discount in the displayed unit price)
4. Create second promotion "-10 from order subtotal" and a coupon.
5. add product to cart, apply coupon, proceed to checkout

Expected results

Actual results

If there's no coupon applied, the product price, subtotal and total are correctly calculated


I'm not sure if this bug is new but right now there's no way to have a promotion for a product + a coupon for the order subtotal.

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gge created an issue. See original summary.

jsacksick’s picture

Component: Discount » Promotions

Indeed! Managed to reproduce the issue, there's something weird happening and it seems a "stale" unit price is accessed at some point from the promotion offer plugin (at least during my tests).

jsacksick’s picture

jsacksick’s picture

So the problem here is that the promotion ""50% Off Prod 1", even if you want it to run before the "10 from order subtotal" promotion, will always run after the coupon based promotion.

That is because commerce applies coupon based promotions first.

So, when the "50% Off Prod 1" promotion gets evaluated, the order item is technically already discounted. So the 50% discount is calculated against the discounted order item total...

Not really sure what to do, because this could be considered as the correct behavior too...

jsacksick’s picture

Status: Active » Needs review
FileSize
1.69 KB

I've been thinking about this further, and decided to restore the previous behavior (i.e calculate the percentage amount against the unit price and not the "adjusted" unit price).

jsacksick’s picture

@gge: Please let me know if that fixes your usecase.

gge’s picture

Just tried the patch and now I get the expected results. At least for me this is the expected behavior.

Thank you very much~

  • jsacksick committed 08a1e6a on 8.x-2.x
    Issue #3268581 by jsacksick, gge: Wrong price and order subtotal...

  • jsacksick committed 4de4db2 on 3.0.x
    Issue #3268581 by jsacksick, gge: Wrong price and order subtotal...
jsacksick’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

loze’s picture

Im my case I do want to calculate the percentage price off the adjusted price. Is there a way to do this?