I'm trying to get all tax rates I set up in my store my custom plugin, I'm using Magento 2.
I found that in db all tax rates are stored in tax_calculation_rate, but I didn't find a method to get all data from this.
Thank you for any help
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityBy using the \Magento\Tax\Model\Calculation\Rate
you can get a list of all the Tax Rates.
$getAllTaxRates = $this->taxRatesModel->getCollection()->getData();
foreach ($getAllTaxRates as $tax) {
$taxid = $tax['tax_calculation_rate_id'];
$taxCode = $tax["code"];
$taxRate = $tax["rate"];
}
where taxRatesModel
is an object of Magento\Tax\Model\Calculation\Rate class.
I hope this helps!