/** * Recalculates buy prices for product * * @param ProductInterface $product */ protected function refreshProductBuyPrices(ProductInterface $product) { $buyPrice = $product->getBuyPrice(); $grossAmount = $buyPrice->getGrossAmount(); $taxRate = $product->getBuyPriceTax()->getValue(); $netAmount = TaxHelper::calculateNetPrice($grossAmount, $taxRate); $buyPrice->setTaxRate($taxRate); $buyPrice->setTaxAmount($grossAmount - $netAmount); $buyPrice->setNetAmount($netAmount); }