如何从magento2中的产品中获得税率和税率? 在magento1中,我们使用下面的代码:
$taxClassId = $item->getData("tax_class_id");
$taxClasses = Mage::helper("core")->jsonDecode(Mage::helper("tax")->getAllRatesByProductClass());
$taxRate = $taxClasses["value_" . $taxClassId];
$taxAmount = (($item->getQty() * $itemPrice * $taxRate) / 100);
最新回答
- 2019-12-51 #
- 2019-12-52 #
我使用\ Magento \ Tax \ Api \ TaxCalculationInterface获得了税率:
$rate = $this->taxCalculation->getCalculatedRate($productTaxClassId, $customerId, $storeId);
这不是一个API,但是我必须使用一次更灵活的获取税率的方法: