I am looking to get the tax rate value from a product (not quote item) in a plugin, which fires on the beforeAddProduct() method.
Currently I have the following in my plugin code:
$taxClassId = $product->getTaxClassId();
this returns an id such as 2
for example.
I attempt to use this value using the Magento\Tax\Api\TaxCalculationInterface
getCalculatedRate() method:
$productTaxRate = $this->taxCalculation->getCalculatedRate($taxClassid);
but then this just returns a 0
which is incorrect as in the admin, the Tax Class is set to A_GEN_STANDARD
which is set to a rate of 20%
Surely there must be a simple to get the tax rate value from a product?
Just to confirm, this is for a product, not a quote item :)
Thanks everyone