WooCommerce: POA / Call for Price @ Single Product

You might want to show a “POA” price and/or a “Call for Price” button when you have a product with an empty price.

Many businesses require this, mostly real estate and wholesalers. So let’s see how it’s done 🙂

Price is now “POA” and a “Request Price” button shows @ WooCommerce Single Product Page

PHP Snippet: Display “POA” & Enquiry Button If Price Empty @ WooCommerce Single Product Page

Before taking a look at the snippet, make sure your “POA” product has no price (regular and sale price). Also, please reference to this other article if you want to add some Javascript to show/hide a Contact Form 7: https://businessbloomer.com/woocommerce-show-inquiry-form-single-product-page-cf7/

/**
 * @snippet       Display "POA" for blank price products @ WooCommerce Single Product
 * @how-to        businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @testedwith    WooCommerce 3.8
 * @community     https://businessbloomer.com/club/
 */
 
add_filter( 'woocommerce_empty_price_html', 'bbloomer_poa_and_enquiry_cf7_woocommerce' );
 
function bbloomer_poa_and_enquiry_cf7_woocommerce() {
   $html = '<div class="poa">POA</div>';
   $html .= '<button type="submit" id="trigger_cf" class="single_add_to_cart_button button alt"> Request Price Now </button>';
   $html .=  '<div id="product_inq" style="display:none">';
   $html .= do_shortcode('[paste_your_contact_form_7_shortcode_here]');
   $html .=  '</div>';
   return $html;
}

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

26 thoughts on “WooCommerce: POA / Call for Price @ Single Product

  1. I’ve packaged something like this up into a plugin, as I needed the exact same kind of functionality on a client site recently. They sell a lot of heavy duty equipment that requires installation: https://chrisjallen.com/2019/05/28/woo-custom-empty-price-add-your-own-call-to-action-when-your-product-has-no-price/

    1. Nice!

  2. Can the code $html .= do_shortcode(‘[paste_your_contact_form_7_shortcode_here]’); be amended to a phone line like:
    $html .= do_shortcode(‘<a href="tel:[$phone];"Call to Order‘); or something to that effect. Forgive my unrelated code entry syntax.

    Then, on the single product admin page, have an additional field to put in a phone number in this type of format: +5551234567

    That way if a different Dept or Section for each individual product would be called, instead of a single generic number. Make sense?

    1. Hello Roberta, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

  3. Hi,
    I have just inserted your code, add a Contact 7 form and then went to the front end and clicked on ‘Request Price’ but nothing happens.

    Contact form short code: contact-form-7 id=”63″ title=”Contact form 1″ and I tried contact-form-7 id=”63″

    I have obviously pasted something wrong! 🙂

    1. Hey Rob, thanks so much for your comment! I just retested this on the latest version of WooCommerce and it still works. Unfortunately this looks like custom troubleshooting work and I cannot help here via the blog comments. Thanks a lot for your understanding! ~R

    2. Hi Rodolfo,

      Thanks for the response. I am not sure what you mean about customerisation as there isn’t any.

      I have just switched to 2015 theme and it still doesn’t work.

      see here: https://synaxissolutions.co.uk/2018/product/testing-testing/

      AS I said maybe I have not completed what is required, but I have pasted the coding into functions.php of 2015

      See here: https://screencast.com/t/PpV3zWH5Np7c

      and I have all plugins deactivated,. see here: https://screencast.com/t/MDFsnpIu2bT

      If it all still works, can you tell me under which theme it works, and I wil debug from there.

      Thanks

    3. Hi,

      I have tested further and managed to get the ‘Requset More detail’ working, but now the ‘Request More Detail’ button does not disappear when I add in price.

      See here: https://synaxissolutions.co.uk/2018/product/epilson-e9-83-twin-controls/

      has price and request more details. See here:https://screencast.com/t/3t7YMofow

      Maybe I have misunderstood the functions.php?

      1. Hey Rob, this should work. Sorry but I can’t provide complementary troubleshooting here via the blog comments – thanks for your understanding 🙂

  4. Is there a way to restrict this to alter just the price of the product on the product page itself? At present, it shows for the price on related products below the product page and on recently viewed products in the sidebar also

    I’ve tried using “if ( is_product() ) {…” and while this stops the button appearing on the shop / category pages, it displays everywhere (active product, related and recent) once in a product page

    Thanks in advance

    1. Hiya Conor, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

  5. Love the article, thanks it helps a lot, my only issue is that i dont use contact form 7, i use Caldera Forms and the short code does not work. any adjustment in code to achieve this?

    1. Hey Wesley, if you change the shortcode it should work out of the box. Make sure the shortcode is written properly and that you keep the single quotes before and after.

    2. Hi Rodolfo, i got your code right, but the only problem is that it shows on pages that have prices too. I have not adjusted your code, other than the label and the short code. So even if there is a price, it still shows up.

    3. Never mind, i am being a tonsil 🙂 I didnt change the action name.

      But it still shows up on the category page, with the button and does nothing when you click on it. I wish i had a programming mind like yours 🙁

  6. Thanks a lot Rodolfo, happens to be just what I was looking for today!

  7. Hello,

    I’m currently working on an ecommerce for a client, using the Woocommerce Storefront theme (editing on child theme version). Right now, I’m trying to display text instead of not showing the product price when left blank. I’ve been looking for a solution to this problem for a while. Im happy I found the code you’ve provided, however no changes or error appeared on the website. Any recommendations?

    1. Hey Allegra, thanks for your comment! This should work when the price is left blank – you have “blank” prices or “zero” prices?

    2. Right now I have some products with and without pricing. The products without pricing are left blank.

      1. Can you try switching to “Twentyseventeen” theme and let me know if the snippet works in that case?

  8. Hello Rodolfo,

    We are also using this snippet.
    Do you have an example ‘code’ to disable the buttons on the shop pages?
    We don’t know how to complete this code.

    Also, we integrated a Contact Form 7.
    The title of the product is showing in the ‘subject’ field.
    But in this subject field, there is html code showing. > –
    Anyway we can hide this? Besides deleting this from every product.

    Example: Josval – FILTRO FES-22000 – Microfilter 22000 l/m

    1. Hey Luuk, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here on the blog. Thanks a lot for your understanding! ~R

  9. Hi Rodolfo,
    I added this snippet and all works fine. Except the “POA” and “Request Price” button is also showing on the shop pages?
    Is there any way to exclude this from showing on the pages?

    1. Hey Cathy 🙂 Yes, of course. Inside the function, use:

      function blablabla() {
      if ( is_product() ) { 
      // run function 
      }
      }
      

      This is called “conditional logic”: https://businessbloomer.com/woocommerce-conditional-logic-ultimate-php-guide/

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *