1

Good Day, Mates!

I am using Magento 2.4.x and try to change its cart price rule mode, I simply want to calculate all discounts (percentage or fixed amount) on Base Price. For example, If a product has base price 100 and special price 80, when a 10% discount code applied the price should be 90 or according to the discount percentage (or amount).

I have been searching for a solution for long time. Do you guys have any idea how can I do that?

A possible solution seems posted by @shourav for Magento 1, nothing is found for Magento 2.

Also that seems not properly honoring conditions.

Thanks!

2
  • Hi Khaled Bin Amir , Have u got solution for this ??? if you have please share us Commented Sep 22, 2021 at 10:37
  • @ChalaChalapathi, No mate, no solution yet and still waiting for one. Commented Nov 30, 2021 at 11:00

1 Answer 1

0

We faced the same problem, and fixed this by creating a patch for the following file: vendor/magento/module-sales-rule/Model/Rule/Action/Discount/ByPercent.php

In our case, this specifically was needed for discount codes applied by percentage.

We edited the function _calculate, in which we have added an additional check. Based on the original price and the final price (special price), we calculated the discount already applied to this cart item. By comparing this to the discount from the cart coupon code, we calculated the remaining discount to apply to these cart items. Result: discount applied on original price, up to the maximum amount of discount from the rule.

Note: this patch needs to be tested further, but for now resulting in correct applied discounts.

1
  • Can you please share patch you have made?
    – Iztok
    Commented Sep 14, 2023 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.