How to to display the text “Call for Price” when the price is 0 or blank
Next code will do the job:
add_filter('woocommerce_get_price_html', 'fbs_woocommerce_get_price_html', 100, 2);
function fbs_woocommerce_get_price_html($price, $product)
{
if ($product->price <= 0)
{
//remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);
//remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30);
return 'Call for Price';
} else
{
return $price;
}
}
