- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using an extension for enable "Add to Quote" option instead of "Add to Cart" for some specific products.
How can I hide price for "Add to Quote" enabled products (attribute ves_enable_quote) and display "Price on request" text?? (as per below image)
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @chathuramk
for that, you need to create a plugin for FinalPriceBox for a simple product
di.xml code
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <preference for="Magento\Catalog\Pricing\Render\FinalPriceBox" type="namespace\modulename\Pricing\Render\FinalPriceBox" /> </type> </config>
class FinalPriceBox
protected function _toHtml() { // condion here if(//your condtion) { return '<div class="price-box"></div>'; }else{ $result = parent::_toHtml(); return $result; } }
hope it will help you.
if works then mark as solution
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @chathuramk
for that, you need to create a plugin for FinalPriceBox for a simple product
di.xml code
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <preference for="Magento\Catalog\Pricing\Render\FinalPriceBox" type="namespace\modulename\Pricing\Render\FinalPriceBox" /> </type> </config>
class FinalPriceBox
protected function _toHtml() { // condion here if(//your condtion) { return '<div class="price-box"></div>'; }else{ $result = parent::_toHtml(); return $result; } }
hope it will help you.
if works then mark as solution
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Hide product price for specific products
Hello @chathuramk
if works then mark as a solution so it will help to other.
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Hide product price for specific products
Hello @Sunil Patel ,
Thank you for your reply.
I created folder structure for new extension and added di.xml in etc folder. I have no idea about second code. where to add below code?
protected function _toHtml() { // condion here if(//your condtion) { return '<div class="price-box"></div>'; }else{ $result = parent::_toHtml(); return $result; } }
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Hide product price for specific products
hello @chathuramk
namespace\modulename\Pricing\Render\FinalPriceBox
where namespace and modulename is your module name.
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Hide product price for specific products
Hello @chathuramk
are still facing any issue?
if not then mark as a solution.
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Hide product price for specific products
Yes still having issues

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Hide product price for specific products
Hello @chathuramk
Why don't you purchase readymade extension
Not much costly https://magecomp.com/magento-2-hide-price.html
https://magecomp.com/magento-2-call-for-price.html
https://magecomp.com/magento-2-email-quote.html
200+ Premium Magento 2 Extensions Need help? Hire Magento Developer