[Documentation] Add info about new decimal tax calculator to docs

This commit is contained in:
Grzegorz Sadowski 2023-06-22 07:13:36 +02:00
parent 1cdca39e5c
commit b3caf45aa4
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364

View file

@ -145,11 +145,24 @@ which has the services that implement the `OrderTaxesApplicatorInterface <https:
Calculators
'''''''''''
For calculating Taxes **Sylius** is using the `DefaultCalculator <https://github.com/Sylius/Sylius/blob/master/src/Sylius/Component/Taxation/Calculator/DefaultCalculator.php>`_.
For calculating Taxes **Sylius** is using tax calculators.
To select a proper service we have a one that decides for us
- the `DelegatingCalculator <https://github.com/Sylius/Sylius/blob/{current_version}/src/Sylius/Component/Taxation/Calculator/DelegatingCalculator.php>`_.
Basing on the **TaxRate** assigned on the Product it will get its calculator type calculate the amount properly.
You can create your custom calculator for taxes by creating a class that implements
the `CalculatorInterface <https://github.com/Sylius/Sylius/blob/master/src/Sylius/Component/Taxation/Calculator/CalculatorInterface.php>`_
the `CalculatorInterface <https://github.com/Sylius/Sylius/blob/{current_version}/src/Sylius/Component/Taxation/Calculator/CalculatorInterface.php>`_
and registering it as a ``sylius.tax_calculator.your_calculator_name`` service.
Built-in Calculators
''''''''''''''''''''
The already defined calculators in Sylius:
* **DefaultCalculator** - calculates the ``amount`` with rounding.
* **DecimalCalculator** - calculates the ``amount`` without rounding, which results in a distribution of decimal values among the items.
Learn more
----------