1

i was wondering how i can have in confirmation email the single item price

like in the image

enter image description here

2
  • Did you ever find a solution? None of the answers here work for me to get the unit price in file app/design/frontend/PACKAGE/THEME/Magento_Sales/templates/email/item/invoice/default.phtml
    – Webninja
    Oct 1, 2020 at 14:58
  • I added single item price using above example. Now how can I align the total section accordingly? ![enter image description here](i.stack.imgur.com/UP5PM.jpg)
    – Chathura
    Oct 10, 2023 at 6:52

5 Answers 5

1

You need to copy the following file to your theme folder like below:

/vendor/magento/module-sales/view/frontend/templates/order/items.phtml

to

/app/design/frontend/YOUR_PACKAGE/YOUR_THEME/Magento_Sales/templates/order/items.phtml

Now add one more th to thead with your required heading name.

Again copy the following file to your theme folder like below:

/vendor/magento/module-sales/view/frontend/templates/order/items/renderer/default.phtml

to

/app/design/frontend/YOUR_PACKAGE/YOUR_THEME/Magento_Sales/templates/order/items/renderer/default.phtml

Here you can one td with the same position as th for heading. You will get the unit price by $_item->getPrice(). Now you need to format this value with currency symbol.

Hope this helps!

1

for the email /app/design/frontend/YOUR_PACKAGE/YOUR_THEME/Magento_Sales/templates/email/items/order/default.phtml

$_order - > formatPrice($_item->getPrice());

above working for me !!

0
<?=  $_order->formatPrice($_item->getPrice()) ?>
1
  • Please add some more details about it.
    – Msquare
    May 1, 2020 at 9:53
0

You need to edit / override following 2 files, if you want to show in sales order emails.

  1. app/design/frontend/YOUR_PACKAGE/YOUR_THEME/Magento_Sales/templates/email/items.phtml

  2. app/design/frontend/YOUR_PACKAGE/YOUR_THEME/Magento_Sales/templates/email/items/order/default.phtml

0

Please check and override the files mentioned below in your custom theme, then verify the email output.

To customize the table header, you need to override the following file and update its content.

vendor/magento/module-sales/view/frontend/templates/email/items.phtml

Please add the following code to the existing file.

<th class="item-price">
    <?= $block->escapeHtml(__('Price')) ?>
</th>

To display the product price value in the HTML of a simple product, use the code provided below.

vendor/magento/module-sales/view/frontend/templates/email/items/order/default.phtml

Please add the following code to the existing file.

<td class="item-price">
    <?= /* @noEscape */ $_order->formatPrice($_item->getPrice()) ?>
</td>

Various types of product HTML are sourced from different files. Please ensure that you are overriding the correct file for your specific product.

For example, HTML for bundle products is sourced from the following path:

vendor/magento/module-bundle/view/frontend/templates/email/order/items/order/default.phtml

After that, there is a misalignment in the total section of your email due to the addition of a new column. To correct this, you need to override the following two files. Add a new tag within the Total section and update the colspan attribute to colspan="4". If there is already colspan="3", update it to colspan="4"

vendor/magento/module-tax/view/frontend/templates/order/tax.phtml

vendor/magento/module-sales/view/frontend/templates/order/totals.phtml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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