Prestashop: Free shipping can be applied multiple times

Created on 16 Jun 2020  路  15Comments  路  Source: PrestaShop/PrestaShop

Describe the bug

You can apply the "Free shipping" discount multiple times on same order.
Might be related to https://github.com/PrestaShop/PrestaShop/issues/19790 .

Expected behavior

Free shipping can be applied only once.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Make order where the total price is at least 3x the shipping price (which should be more than 0)
    image
  2. go to order in backoffice
  3. click "Add a discount"
  4. Choose free shipping
  5. click "Add a discount"
  6. Choose free shipping
  7. 2nd discount for shipping was added.
    image

Additional information

  • PrestaShop version: 1.7.7.x - c7471b7
  • PHP version: PHP 7.3.14-1~deb10u1
1.7.7.0 BO Bug Duplicate Minor Order Shipping

All 15 comments

Thanks for opening this issue! We will help you to keep its state consistent

I thought I fixed that in https://github.com/PrestaShop/PrestaShop/pull/18321 馃

@matks maybe the issue is the free_shipping is on 2 places: CartRule and OrderCartRule.
The one in OrderCartRule is 0 and the one in CartRule is 1.

Hi @ikulis ,

I reproduced your issue in PS 1.7.7.0 with your steps.
I鈥檒l add this to the debug roadmap so that it鈥檚 fixed. If you have already fixed it on your end or if you think you can do it, please do send us a pull request!

@matks
In #18321, the issue was in the FO, this one occurs in the BO

Thanks!

But BO and FO are supposed to use the same logic 馃槄 ...

Anyway if you reproduce, it means there is something to fix 馃挭

ping @florine2623 can you confirm this is a regression ?
I did not reproduce it on 1765, but if you can try on your side, just to be safe ;)

It is not a regression for me, I reproduced it in PS 1.7.6.5 too.
Please check my screenshot :
Capture d鈥檈虂cran 2020-06-17 a虁 17 32 01

Oh, I believe in "Create an order" page it's OK (I just checked), "free shipping" discounts do not stack.

However it might not be wrong in "Edit/view an order" page.

Yes: confirmed. You can stack "free shipping" discounts in "Edit an order" page 馃槃

All right, for the record:

We might look into @zuk3975 work who tried to refactor in AddCartRuleToOrderHandler https://github.com/PrestaShop/PrestaShop/pull/17348 (but could not get it merged) to see if it does the trick

And here is a Behat scenario that reproduces (and validates) the wrong behavior to be fixed:
https://github.com/PrestaShop/PrestaShop/compare/1.7.7.x...matks:failing-double-freeshipping-scenario?expand=1

$ ./vendor/bin/behat -c tests/Integration/Behaviour/behat.yml -s order --tags aaa

  @add-discounts-to-order
  Scenario: Add free shipping discount to order twice, the 2nd discount should not have effects
    Given order "bo_order1" does not have any invoices
    When I add discount to order "bo_order1" with following details:
      | name | free shipping for you |
      | type | free_shipping         |
    And I add discount to order "bo_order1" with following details:
      | name | free shipping for you - again! |
      | type | free_shipping                  |
    Then order "bo_order1" should have following details:
      | total_products           | 23.8  |
      | total_products_wt        | 25.23 |
      | total_shipping           | 7.42  |
      | total_shipping_tax_excl  | 7.0   |
      | total_shipping_tax_incl  | 7.42  |
      | total_discounts_tax_excl | 7.0   |
      | total_discounts_tax_incl | 7.42  |
    Then Order "bo_order1" should have following prices:
      | products  | $23.80 |
      | discounts | $7.00  |
      | shipping  | $7.00  |
      | taxes     | $1.43  |
      | total     | $23.80 |

``

@matks additionally to your behat test, I would another one at the end that adds a product with free shipping (different from adding the discount directly), and checks that the free shipping is still unique

As this is not a regression of 176, this issue is removed from the 177 kanban.
Thanks

Hi all,

This ticket is a duplicate of #18576
So, I close it.
Thanks!

Duplicate of #18576

Was this page helpful?
0 / 5 - 0 ratings