Question

For my store I have

Configuration -> Sales -> Tax -> Price Display Settings -> Display Product Prices In Catalog ---> "Including and Excluding Tax"

For all products on my site the price Excl. Tax and price Inc. Tax are displayed.

Price inc and excl tax

I would like to remove the Excl. Tax data-label on the product page only. This will allow me my own label which is linked to the product attributes.

The trouble is i cannot stop the Excl. Tax data label from showing.

If I use CSS

.price-container .price-including-tax + .price-excluding-tax, .price-container .weee {
    visibility: hidden;
}

or

display: none;

then both price and label are removed

Price Inc Tax using display: none

I would like to avoid having to edit core files if possible

Price Excl. Tax template is generated from

/vender/magento/module-tax/view/base/templates/pricing/adjustments.phtml

<?php if ($block->displayBothPrices()): ?>
    <span id="<?= /* @escapeNotVerified */ $block->buildIdWithPrefix('price-excluding-tax-') ?>"
          data-label="<?= $block->escapeHtml(__('Excl. Tax')) ?>"
          data-price-amount="<?= /* @escapeNotVerified */ $block->getRawAmount() ?>"
          data-price-type="basePrice"
          class="price-wrapper price-excluding-tax">
        <span class="price"><?= /* @escapeNotVerified */ $block->getDisplayAmountExclTax() ?></span></span>
<?php endif; ?>

and block is

/vender/magento/Weee/Pricing/Render/TaxAdjustment.php

Does anyone know how i can hide just the label

Was it helpful?

Solution

If you want to change label text, you can change that in translation file of tax module.

However if you want to remove tax label only on product detail page ( using css ), here is css class you have to use:

for Product detail page :

.product-info-price .price-including-tax+.price-excluding-tax:before
  { display : none }

for Product and Listing page :

.price-including-tax+.price-excluding-tax:before
  { display : none }

hope it will help

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top