Stacked "Percentage off each matching product" promotions result differs based on "display inclusive" setting

Created on 23 May 2022, about 2 years ago
Updated 28 July 2023, 11 months ago

Describe your bug or feature request.

The issue is probably linked to πŸ› Wrong price and order subtotal calculation when using a promotion + a promotion with coupons Fixed and #3220527: OrderItemPercentageOff should calculate the adjustment amount against the adjusted total price β†’ .
When two or more promotions of type "Percentage off each matching product" are applied to the same product, the result differs depending on whether you select "Include the discount in the displayed unit price" or "Only show the discount on the order total summary".
When the former is selected, the second promotion amount as calculated based on the order item amount, including the previous promotion(s), while if the latter is selected, the second promotion is based on the non-discounted order item price, no matter the previously applied promotion(s).

If a bug, provide steps to reproduce it from a clean install.

Using the commerce demo profile on simply test me
- Add a promotion of type Percentage off each matching product, 10 % discount, applies to the Wooden Bowl in Blue and keep the default "Include the discount in the displayed unit price"
- Create a second promotion with the same configuration, 20% discount (could also be 10%, it doesn't matter)
- Order the product (product/34) and proceed to the shopping cart. The total is 17.49 $
Calculation behind:
24.99 - (24.99 * 0.1) - (24.99 * 0.2) = 17.49

Now edit the two promo, end select "Only show the discount on the order total summary" instead, go back to the cart and refresh the order. The total is now 17.99 $
Calculation behind:
24.99 - (24.99 * 0.1) - ((24.99 - (24.99 * 0.1)) * 0.2) = 17.99

The next step before providing a patch is to know which approach is the correct one? For my use cases, the expected result is 17.99, but it is pretty likely that many other users would expect something else. A promotion-level setting could be a solution, even though this may clutter the UI.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Promotions

Created by

πŸ‡«πŸ‡·France nanak Sarlat-la-CanΓ©da

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States AaronBauman Philadelphia

    I'm having very similar behavior with a single "fixed amount" promotion - no stacking.
    Based on whether I select "include unit price" or "order summary", cart items are ending up off by a penny or two for the former, but correct when I choose the latter.

  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    Hi,

    I end up with the same problem (slightly different scenario).

    I agree that "display inclusive" should only be cosmetic.

    I can't use the "Include the discount in the displayed unit price" option, which gives the correct calculation because the promotion should be global, and in case of refund people should not think one article was more promoted than another.

    Regarding comment 5, I guess that it will not be fixed soon, so I will try a custom solution.

  • Status changed to Needs review 11 months ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 11 months ago
    772 pass, 3 fail
  • πŸ‡³πŸ‡±Netherlands basvredeling Amsterdam

    How about this approach? It adds a "stack promotions" configuration option to the promotions that use the percentage off trait. The current patch only implements it for OrderItemPercentageOff promotion offers. The patch needs additional work to be applied to OrderPercentageOff promotions, but the concept is clear I guess.

    When the percentage promotions are configured to stack (default behaviour), the percentages are calculated cumulatively. That is: discounts are calculated upon discounted unit prices. If it is configured to NOT stack, the promotions will resolve the original unit price and be calculated as a percentage of that price.

Production build 0.69.0 2024