Example #1
0
 /**
  * Get sales item (quote item, order item etc) price including tax based on row total and tax amount
  *
  * @param   \Magento\Framework\DataObject $item
  * @return  float
  */
 public function getPriceInclTax($item)
 {
     if ($item->getPriceInclTax()) {
         return $item->getPriceInclTax();
     }
     $qty = $item->getQty() ? $item->getQty() : ($item->getQtyOrdered() ? $item->getQtyOrdered() : 1);
     $taxAmount = $item->getTaxAmount() + $item->getDiscountTaxCompensation();
     $price = floatval($qty) ? ($item->getRowTotal() + $taxAmount) / $qty : 0;
     return $this->priceCurrency->round($price);
 }