2

At the moment the price is displayed like this :

Price incl. Tax

Price excl. Tax

And I would like to display it like this :

Price excl. Tax

Price incl. Tax

In a previous question someone answered that you had to put :

<?php if ($block->hasAdjustmentsHtml()): ?>
    <?= $block->getAdjustmentsHtml() ?>
<?php endif; ?>

at line ~15 of module-catalog/view/base/templates/product/price/amount/default.phtml (I'm working on a test server, I will override it on the production server)

I tried this and it displayed :

Price excl. Tax Price incl. Tax

Price excl. Tax

I'm not sure what getAdjustementsHtml() does and I can't find it in the catalog file. I'm quite new to Magento and web in general so I'm a bit lost in Magento's architecture.

Any help will be greatly appreciated

EDIT: I succeeded to obtain something okay for now : activate only excl. tax display and override the price display, then get the excl. tax price, multiply it by the tax rate and display this where you want. This works only if all your products have the same tax rate obviously.

1 Answer 1

0

You can change order by changes in some vendor file and override them by your own demand.

For Cart Page go in module-tax:

path : vendor/magento/module-tax/view/frontend/web/template/checkout/cart/totals/grand-total.html

Change <tr> order:

<tr class="grand totals excl">
<th class="mark" scope="row">
    <strong data-bind="i18n: exclTaxLabel"></strong>
</th>
<td data-bind="attr: {'data-th': exclTaxLabel}" class="amount">
    <strong><span class="price" data-bind="text: getGrandTotalExclTax()"></span></strong>
</td>

enter image description here

For Checkout Page go in module-tax:

path : /vendor/magento/module-tax/view/frontend/web/template/checkout/summary/grand-total.html

Change <tr> order:

<tr class="grand totals excl">
<th class="mark" scope="row">
    <strong data-bind="i18n: exclTaxLabel"></strong>
</th>
<td data-bind="attr: {'data-th': exclTaxLabel}" class="amount">
    <strong><span class="price" data-bind="text: getGrandTotalExclTax()"></span></strong>
</td>

enter image description here

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.