cancel
Showing results for 
Search instead for 
Did you mean: 

How to get price excluding tax

SOLVED

How to get price excluding tax

Hi, I want to display price excluding tax.

In vendor/magento/module-sales/view/frontend/templates/email/items.phtml I added new th.

items.phtml with my custom th:

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
// phpcs:disable Magento2.Templates.ThisInTemplate
/** @var $block \Magento\Sales\Block\Order\Email\Items */
?>
<?php $_order = $block->getOrder() ?>
<?php if ($_order) : ?>
    <?php $_items = $_order->getAllItems(); ?>
    <table class="email-items">
        <thead>
            <tr>
                <th class="item-info">
                    <?= $block->escapeHtml(__('Items')) ?>
                </th>
                <th class="item-qty">
                    <?= $block->escapeHtml(__('Qty')) ?>
                </th>

/*MY CUSTOM TH*/ <th class="item-price"> <?= $block->escapeHtml(__('Price excluding tax')) ?> </th>
/*END OF MY CUSTOM TH*/
<th class="item-price"> <?= $block->escapeHtml(__('Price')) ?> </th> </tr> </thead> <?php foreach ($_items as $_item) : ?> <?php if (!$_item->getParentItem()) : ?> <tbody> <?= $block->getItemHtml($_item) ?> </tbody> <?php endif; ?> <?php endforeach; ?> <tfoot class="order-totals"> <?= $block->getChildHtml('order_totals') ?> </tfoot> </table>

In vendor/magento/module-sales/view/frontend/templates/order/items/renderer/default.phtml I added this code 

<td class="col sku" data-th="<?= $block->escapeHtml(__('SKU')) ?>">
        <?= /* @noEscape */ $block->prepareSku($block->getSku()) ?>
    </td>

/* MY CUSTOM TD */ <td class="col price" data-th="<?= $block->escapeHtml(__('Price excluding tax')) ?>"> <?= $block->???????() ?> </td>
/* END OF MY CUSTOM TD */
<td class="col price" data-th="<?= $block->escapeHtml(__('Price')) ?>"> <?= $block->getItemPriceHtml() ?> </td>

 

Which variable I should use instead of "???????" to display price without tax ?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to get price excluding tax

Hello @f45879 

 

Please follow below steps :

1. On the Admin sidebar, go to Stores > Settings > Configuration.
2. In the left panel, expand Sales and choose Tax.
3. Expand  the Price Display Settings section.
4. For Display Product Prices in Catalog, choose one of the following:
(a )Excluding Tax
(b) Including Tax
(c) Including and Excluding Tax

It may help you.

Thank you.

Problem solved? Click Accept as Solution!

View solution in original post

5 REPLIES 5

Re: How to get price excluding tax

Hello @f45879 

 

Please follow below steps :

1. On the Admin sidebar, go to Stores > Settings > Configuration.
2. In the left panel, expand Sales and choose Tax.
3. Expand  the Price Display Settings section.
4. For Display Product Prices in Catalog, choose one of the following:
(a )Excluding Tax
(b) Including Tax
(c) Including and Excluding Tax

It may help you.

Thank you.

Problem solved? Click Accept as Solution!

Re: How to get price excluding tax

But I want to display price excluding tax in email templates, not in catalog.

Re: How to get price excluding tax

The information provided is very useful, I often follow them, then play run 3 for fun, it's a pretty cool knockout game

Re: How to get price excluding tax

Otro punto fuerte de pelisflix 2  es su versatilidad en términos de dispositivos compatibles. Los usuarios pueden acceder a la plataforma desde una variedad de dispositivos, como televisores inteligentes, computadoras portátiles, tabletas y teléfonos inteligentes.

Re: How to get price excluding tax

hi