Prestashop: Tax Rules - Cannot set zipcode range starting with 0 (ex: 00000-96999)

Created on 2 Dec 2020  路  2Comments  路  Source: PrestaShop/PrestaShop

Describe the bug

In the tax rules configuration, when we set a zipcode range for a specific country starting with 0 (00000-96999), the range is not applied.
If we go back to the range configuration, it will be displayed '0' instead of '00000-96999'.

Also, we cannot use the range '00001-96999' as a workaround, because a default address with a zipcode '0' is set for tax calculation with guest. So if we use a range starting with '00001', guest will not see prices tax included.

Expected behavior

We expect that when we set a range starting with '00000', this range is correctly saved and applied to the tax calculation.

Steps to Reproduce

  1. International > Taxes > Tax Rules
  2. Click on Edit a tax rule
  3. Then, edit a country
  4. Set a valid zipcode range starting with '00000' (you should adapt the format to the country
  5. Save
  6. Click again to the country, a '0' will be displayed in the field.

Also, on the shop, the zipcode range will not be applied. The problem must be on a bad condition (== instead of === ?)

Additional information

  • PrestaShop version: tested on 1.7.6.7 and 1.7.7.0
  • PHP version: tested on 7.1.25 and 7.3.25
1.7.7.0 BO Bug International Tax rules To Do

Most helpful comment

Sounds like (string) '00000' being coerced into (int) 0

All 2 comments

Sounds like (string) '00000' being coerced into (int) 0

Hello @cdcvince

I was able to reproduce your issue with PS1.7.6.9 and PS1.7.7.0, see the attached screen record below:

https://drive.google.com/file/d/1yjtjHKXlW6odntaGihrfvp3VEJcZjvKn/view

I鈥檒l add this to the debug backlog 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!

Thanks!

Was this page helpful?
0 / 5 - 0 ratings