0

I want remove particular product price in category page.

2
  • There is not enough actionable information here to offer an answer. Can you edit your question to include: (0) You want to show/remove the price for the specific type of product. (1) Do you want to remove the price for Out of stock products? (2) You want to remove the price for a specific product only. With this, it may be possible to offer an answer … Dec 8, 2021 at 9:07
  • I want to show/remove the price for the specific type of product
    – user101695
    Dec 8, 2021 at 9:09

2 Answers 2

0

Create an attribute of Yes/No type with the name is_hide_price.

then assign attribute value to particular product

app/design/frontend/YOUR_VENDOR/YOUR_THEME/Magento_Catalog/templates/product/list.phtml

Replace:

<?= /* @noEscape */ $block->getProductPrice($_product) ?>

to

<?php
if ($_product->getIsHidePrice() == 1) {
    echo /* @escapeNotVerified */ $block->getProductPrice($_product);
}?>

This will work for you.

1

Open your list.phtml template file.

app/design/frontend/VENDOR/THEME/Magento_Catalog/templates/product/list.phtml

Search for the below price code, from where your price is displayed.

Replace:
<?= /* @noEscape */ $block->getProductPrice($_product) ?>

To:

<?php
$productType = 'configurable'; // add your product type here for which you want to remove the price i.e. configurable, simple, grouped, virtual, downloadable and bundle.
if ($_product->getTypeId() != $productType) {
    echo /* @escapeNotVerified */ $block->getProductPrice($_product);
}
?>

This will not show the prices for products with type configurable from your list pages.

Hope this will help!

Your Answer

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