Ajouter un commentaire

Soumis par Jorge (non vérifié) le 14/04/2021 à 18:53 - Permalien

Spanish taxes depends on the product but also on the customer. A product could have one of this taxes: normal (21%), reduced (10%) and super-reduced (4%). This is managed by a field on the variation type and it works good. But there is another variable that has to be considered. The customer could has a type of bussines that implies to add another additional tax to the same product. They are named "surcharge" and they are normal (5.2%), reduced (1.4%), super-reduced (0.5%). It is calculated in the next form:
Product price without taxes: 100 €
Normal taxes (21%): 100 * (21 / 100) = 21 €
Surcharge (5.2%): 100 * (5.2 / 100) = 5.2 €
Order total: 100 + 21 + 5.2 = 126.2€

Implementing a class ProductTaxResolver implements TaxRateResolverInterface let me add one tax but I need to add more than one, depends on a customer field (custom user field). How could I do it? Could I add another tax with a custom tax condition?