Reworking the pricing engine in PrestaShop #41040
Replies: 15 comments 44 replies
-
|
Scenario:
Current status:
|
Beta Was this translation helpful? Give feedback.
-
|
Optional price on country level? This wil give a "nice" price in the country of choice including VAT, even when VAT rates changes by country. |
Beta Was this translation helpful? Give feedback.
-
|
Here are a few common cases that currently require overrides due to missing native support:
Native support for these cases would be great. |
Beta Was this translation helpful? Give feedback.
-
|
Other than what already said above, please stop using 6 decimals to store price data. There are lots or rounding error in final prices, no matter if set per product/line/total. There will always be discrepancies. |
Beta Was this translation helpful? Give feedback.
-
|
Does this mean that it will be released as a whole new upgrade version? Or will it be module only based to where any version of PrestaShop 9.x can use it? Also, please make sure you fix the issues with the Shipping Price Ranges for USD as mentioned in my post here. Thank you! |
Beta Was this translation helpful? Give feedback.
-
|
We would also need to consider Norway, which has the VOEC system, similar to the OSS system for Europe. |
Beta Was this translation helpful? Give feedback.
-
|
If PrestaShop wants to follow EN-16931 this is the correct way to do the math: First we have to take in mind that we can use as many decimals as we need, but the price should be shown with the total number of decimals in every place, here resides many of the rounding issues PrestaShop have, so if we set 0.012581β¬ we must show that price on the invoice and FO, I explained this before. The math is as follows if we want to use 6 decimals:
There is a huge difference as we can see doing it in one way or another. |
Beta Was this translation helpful? Give feedback.
-
|
Great idea, and congratulations on the planned redesign!
|
Beta Was this translation helpful? Give feedback.
-
|
Adding hooks to add one or more ad hoc amounts as additional expenses? |
Beta Was this translation helpful? Give feedback.
-
|
Great to hear! @kpodemski PS is at the moment calculating with net (tax exclusive) prices. In many countries B2C requires prices to be tax inclusive. Then, to avoid rounding, all calculations have to be done on the tax inclusive prices. If you want to have the current and the new calculations in parallel, you need to introduce new price properties in every data structure. |
Beta Was this translation helpful? Give feedback.
-
Thanks! I was incorrect. This one is calculating in parallel on tax inclusive and tax exclusive. The product price is always kept as tax exclusive price. I was analysing the code a while back.
The invoicing is done based on the price that is displayed with the prodcut. That can, depending on the country, be tax inclusive or tax exclusive. The majority of consumer prices is tax inclusive. Here is an overview:
I just AI generated this. This is not to be meant as a reference just as an idea about that this is handled differently by country. |
Beta Was this translation helpful? Give feedback.
-
|
@cruftex Displayed price is a different thing tho. Displaying rules differs from fiscal rules when invoicing. that's why sometimes you can find a rounding additional line at the end of invoces with (+- some cents) to make it even. |
Beta Was this translation helpful? Give feedback.
-
No its not. If you buy something for 5 Euro (displayed price), the price on the invoice is the same. How would you otherwise know the invoice is correct? I discussed that here: #32969 Here is the pseudo code: |
Beta Was this translation helpful? Give feedback.
-
|
I don't see any PRs referenced. If I should have a look at a PR, can you please mention me there? |
Beta Was this translation helpful? Give feedback.
-
|
Didn't have time to read trough everything but at least in Finland there is one interesting edge case regarding bottle deposits. As the contents is usually "food item" it is using a different tax class than the deposit. Just wanted to high light a case where one product can actually contain multiple vat rates :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Price calculation has been one of the most discussed topics in the PrestaShop ecosystem for years. It consistently ranks among the top pain points reported by merchants and agencies, and we know many of you have run into issues. We're now starting a dedicated project to address this: a new pricing calculation system, built to be reliable, consistent, and properly tested.
What we're building
Instead of monolithic pricing logic, the new engine breaks computation into dedicated calculators, each responsible for a single domain:
Each calculator implements a shared interface and is orchestrated by a central component that runs them in sequence. This makes the pipeline extensible (adding a new pricing concern means adding a new calculator) and testable (each calculator can be unit-tested in isolation).
We're also standardizing rounding behavior across the entire pricing chain, so that a single, well-defined strategy applies everywhere, from the catalog to the order confirmation.
How we're rolling it out
The new system will be introduced gradually, behind a feature flag, and connected to the existing user journey step by step:
At each step, we validate the full order lifecycle before moving forward.
We need your input
We have a good picture of the issues tracked on GitHub, but we know that probably doesn't cover everything. We're especially interested in hearing about:
If you've run into pricing problems that made you think "this absolutely needs to be fixed" now is the time to share them.
You can follow along and find all the tasks related to this project here on GitHub.
We'll share updates and individual stories as development progresses.
Beta Was this translation helpful? Give feedback.
All reactions