Prestashop: Discount is not computed correctly with free gift

Created on 11 Dec 2018  Â·  26Comments  Â·  Source: PrestaShop/PrestaShop

Describe the bug
When 2 cart rules with a free gift are applied, discount is not computed correctly in cart summary

To Reproduce
Steps to reproduce the behavior:

  1. Create 1 cart rule with a free gift
  2. Create a 2nd rule with the same configuration than before
  3. Check cart summary

Screenshots
Cart rule example
Cart rule example

Cart problem
Cart problem

Additionnal information
PrestaShop version: Reproduced in PS 1.7.4.4 and PS 1.7.5 RC1

1.7.4.4 1.7.5.0 1.7.6.0 BO Bug Cart rules Discounts FO Fixed Major Order PR available Topwatchers

Most helpful comment

We and some of our merchants in 1.7 are concerned by this issue.

All 26 comments

Hi @idnovate,

Thanks for your report.
I manage to reproduce the issue with PS1.7.5.0rc1.
In the shopping cart page => NOK
image
In the order confirmation
image
In the order detail BO => NOK
image

The discount should be 68,92€

In the invoice => NOK
image
Thanks!

Related to #9757

Hi,

This issue occurs also when we have two cart rules with free shipping vouchers as reported here #12024
image
Thanks!

Hi!
Its an important bug, any solution?

Hi @webstartconsulting,

Sorry, not yet.

Hi!

Same problem when 2 cart rules with free gift is applied.

  • Create 2 cart rules like this:

image

  • Shopping cart is €52.46 instead of €35.09:

image

+1 on the urgency this issue. We are experiencing it on a live site and daily manual corrections, and emails to customers, are necessary because of it.

unnamed

This is fixed by us in PR-13704 (Tomlev rebranched it ;))
https://github.com/PrestaShop/PrestaShop/pull/13704

(Tested on site of lijndiensten)

@venditdevs this issue is not fixed by #13704

capture d'écran_1637

If you have a fix, please make a pull request on GitHub with your code suggestion
https://github.com/PrestaShop/PrestaShop/tree/develop

Thank you!

This is fixed by us in PR-13704 (Tomlev rebranched it ;))

13704

(Tested on site of lijndiensten)

Maybe in your case 🤔 but it seems there might be more cases where the bug still happens 😢 according to marionf

If i can find some time in the coming weeks i will take a look if i can fix this problem too
.
The cartrule code is mess. This wasn't tested before releasing 1.7.x , it just can 't be. So many errors and odd behaviours.

We and some of our merchants in 1.7 are concerned by this issue.

Hi,
Still no solution ? It's not a minor bug for us...
Any forecasted milestone ?

Hi,
any update for this bug?
Thank you :)

Hi @ladisbot,

Sorry not yet.
PrestaShop is an open-source project, so it can be solved before if someone submits a pull request to solve it.

Thanks!

@marionf @colinegin @khouloudbelguith @jf-viguier

Made a PR with a fix guys #16635. Test it please, should work fine.

@marionf @colinegin @khouloudbelguith @jf-viguier

Made a PR with a fix guys #16635. Test it please, should work fine.

This PR fixes https://github.com/PrestaShop/PrestaShop/issues/11722#issuecomment-499413873. Tested with 1.7.6.2 which already includes https://github.com/PrestaShop/PrestaShop/pull/13704

Thank you very much @Hlavtox !

Unfortunately there is still some issue:

Issue 1:
Create the following rules:

  • Rule 1
    Amount discount:
    image

  • Rule 2
    Free gift
    image

  • Rule 3
    Free gift
    image

Cart:
image

Issue 2:

  • Change the first rule:
    image
  • Discount is higher than amount
    image

@idnovate What if you set priority to gift rules to 1 and the discount rules to 2?

Then all is OK:

image

image

@Robin-Fischer-PS could you check @idnovate comments ?

Thanks !

@colinegin

@idnovate is right, I didn't think of this situation. :-(

Order of cart rules must be - gifts first, discounts second, in order for the fix to work. Perhaps if you guys fixed this cart rule order as I proposed in #16642?

Because now, if you simulate @idnovate's situation:

  • discount cartrule - it applies the discount for all products in cart, even the gift ones.
  • gift cartrule - discounts the original product price, before the first cart rule was applied.

Hi @idnovate, @colinegin, @Robin-Fischer-PS,

I manage to reproduce the issue described by @idnovate with the develop branch.
I will create a new issue.

Thanks!

Hi @colinegin,

Issue created: https://github.com/PrestaShop/PrestaShop/issues/16673
I added the label Regression because, in the PS1.7.6.2 => the total is well calculated.
@colinegin what do you think?

Thanks!

Yes @khouloudbelguith , I agree with you. I add it to the 1.7.7 kanban.

Was this page helpful?
0 / 5 - 0 ratings