WooCommerce: POA / Call for Price @ Single Product

Published by axmin on

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

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://axio.ir/woocommerce-show-inquiry-form-single-product-page-cf7/

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;
Categories: Woocommerce


دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *