0

Is their any way to Get product price including tax in order confirmation email ?

3
  • any thoughts on this ? Aug 2 at 10:48
  • Can you explain your requirement? Aug 3 at 4:27
  • In a customized order confirmation email template, there is customization that displays ordered products, but the price for that products is not tax included Aug 3 at 5:05
2
+50

This might help

Create helper class

use Magento\Sales\Api\OrderItemRepositoryInterface;

class Data extends AbstractHelper
{
     /**
     * Order Item Repository
     *
     * @var OrderItemRepositoryInterface
     */
     private $orderItemRepository;

     public function __construct(
        OrderItemRepositoryInterface $orderItemRepository
     ) {
        $this->orderItemRepository = $orderItemRepository;
     }

     /**
     * Get price including tax
     */
    public function getPriceInclTaxByItemId($itemId)
    {
        return $this->orderItemRepository->get($itemId);
    }

In phtml file

/** @var $_item \Magento\Sales\Model\Order\Item */
$_item         = $block->getItem();

$ordered_item_id = $_item->getOrderItemId() ? $_item->getOrderItemId() : $_item->getId();

$itemPrice = $helper->getPriceInclTaxByItemId($ordered_item_id);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.