1

Vendor/Sales/view/frontend/layout/sales_email_order_shipment_items.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Shipment Items List" design_abstraction="custom">
    <body>
        <referenceBlock name="items">
            <action method="setTemplate" >
                <argument name="template" xsi:type="string">Vendor_Sales::email/shipment/items.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page

Vendor/Sales/view/frontend/templates/email/items/shipment/default.phtml

<?php
/** @var $_item \Magento\Sales\Model\Order\Item */
$_item         = $block->getItem();
$_order        = $_item->getOrder();
$helper        = $this->helper('Vendor\Sales\Helper\Data');
$product_image = $helper->getProductImage($_item->getSku());
$productObj    = $helper->getProductBySku($_item->getSku());
$color         = $productObj->getAttributeText('color');
$size          = $productObj->getAttributeText('size');
$brand         = $productObj->getDisplayBrand();
$product_url = $helper->getProductFrontendUrl($productObj);
$itemDiscounted = false;
$itemFree = false;
$itemQty       = $_item->getQty();
$specialPrice = $helper->formatProductPrice($_order->getOrderCurrencyCode(),$productObj->getSpecialPrice());
$regular_price = $helper->formatProductPrice($_order->getOrderCurrencyCode(),$productObj->getPrice('regular_price'));
$originalPrice = $_item->getOriginalPrice() > 0 ? $_item->getOriginalPrice() : $regular_price;

$store = $block->getOrder()->getStore()->getCode();
$itemRowTotal = $store == 'us' ? $_item->getPrice() * $itemQty : $_item->getPriceInclTax() * $itemQty;

$itemRowTotal is set as product price in shipment email but it shows 0 instead of actual price

any thoughts what can be the issue ?

2
  • I found that on some product/time this $_item->getPriceInclTax() method is not found on $_item object.
    – devhs
    Aug 2, 2021 at 7:48
  • any thoughts what can be the issue ?
    – devhs
    Aug 2, 2021 at 10:11

1 Answer 1

0

You can use xdebug or set a log to check the data of the $_item variable. I think this variable is not having data

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.