0

I would like to apply tax on a product if a user selects "Store Pickup" as a shipping carrier. Here is my scenario:

State A: Tax 5%

State B: Tax 3%

Rest of the state: 0%.

Now, if someone's delivery address is within "State A" then a 5% tax will be applied. It's working fine. Similarly, it's working fine for other states too.

The issue is, if someone's delivery address is within State C, D, or E (where tax is 0%) and he/she chooses "Store Pickup" as the shipping carrier then I would like to apply a tax of 5% because this store is within "State A" (where tax is 5%). Is it possible to enforce a 5% tax if the user selects "Store Pickup"? Or forcefully change the delivery address to the Store address (because Prestashop uses the delivery address to calculate Tax) if the customer selects "Store Pickup"?

Looking forward to some ideas on how to achieve this. Thanks!

atiquratik
  • 1,296
  • 3
  • 27
  • 34

1 Answers1

1

I guess this is not doable natively, I achieved something similar in the past by overriding the constructor of TaxCalculator

Try checking the current State and Carrier in the context object, then edit the array of taxes according to your desired logic.

gennaris
  • 1,467
  • 1
  • 11
  • 17
  • thanks for the heads up. Is it only TaxCalculator Class that I need to modify or other classes/controllers too? – atiquratik Apr 19 '23 at 17:20
  • I tried to override some functions on the TaxCalculator Class based on `id_carrier` but I don't see any reflection of taxes on the cart or checkout. Not sure if I am doing this correctly. Is it possible to share some code so that I can get more ideas? Thank you! – atiquratik Apr 19 '23 at 18:09
  • 1
    You'll need to edit the class constructor and return the desired array of taxes, this will affect all current carts. – gennaris Apr 20 '23 at 12:43
  • I came up with an alternative solution but thank you for your suggestions! I will look into it later on. – atiquratik Apr 21 '23 at 06:44