/** * Updates an existing order's product * * @param OrderProductInterface $orderProduct * @param array $productValues */ protected function updateOrderProduct(OrderProductInterface $orderProduct, array $productValues) { $sellPrice = $orderProduct->getSellPrice(); $grossAmount = $productValues['gross_amount']; $taxRate = $orderProduct->getSellPrice()->getTaxRate(); $netAmount = TaxHelper::calculateNetPrice($grossAmount, $taxRate); $sellPrice->setTaxRate($taxRate); $sellPrice->setTaxAmount($grossAmount - $netAmount); $sellPrice->setNetAmount($netAmount); $sellPrice->setGrossAmount($grossAmount); $orderProduct->setWeight($productValues['weight']); $orderProduct->setQuantity($productValues['quantity']); }