0

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)

enter image description here

1
  • How confident are you at programming. I would go down the route of adding a yes / no product attribute and coding a plugin (interceptor) Commented May 17, 2019 at 19:32

2 Answers 2

0

I was surprised to see some extension developers charging for this. I had a couple of hours down time. I created something. Although I can't say how it will fit with your current extension but hopefully you will all find it useful.

https://github.com/DominicWatts/Magento-2-Call-For-Price/

Toggle in Store Configuration, plus add text

Configuration

configuration

Product Edit

configuration

Product List

result

Product Display

result

5
  • Hi Dominc, I highly appreciate your effort for this :) this works for me very nicely. But only on product detail page. How can I display call for price text on Category pages and search auto complete?
    – Chathura
    Commented May 18, 2019 at 20:00
  • Worked for me on product list page. I think that's what you call category page. See screenshot. Sorry didn't check autocomplete. Is your autocomplete custom? Didn't realise it showed prices. If you've got customizations they will have to look at the attribute the extension created and conditionally show price in other template files. Essentially something like the other answer. Commented May 18, 2019 at 20:41
  • Hi Dominic, yes it’s working on product list page. But not it swarch autocomplete. We are using ElasticSuite with ElasticSearch as search engine
    – Chathura
    Commented May 19, 2019 at 4:25
  • Also "Add to Quote" button also disappeared. How can I turn off hiding of Add to Cart or Add to Quote button from your extension?
    – Chathura
    Commented May 19, 2019 at 5:16
  • The issalable part turns off add to cart. That's because I assumed you would not want call for price items to be allowed to be added cart. You can comment that bit out. Commented May 19, 2019 at 12:00
0

Create a product attribute. Something along the lines of 'Hide Product Price'. How to create attribute

Then in your price display template file get the attribute (credit: Magento 2: How to display custom attribute in catalog?)

$_getMyAttr = $_product->getResource()->getAttribute('my_attribute');

if ($_getMyAttr){
    // Get Value
    $attrTestValue = $_getMyAttr->getFrontend()->getValue($_product);
}

and use it to conditionally display your price. I believe the price template is final-price.phtml.

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.