PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Price upon request

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Hi Support,
Please help me with this code:
add_filter( 'woocommerce_get_price_html', 'custom_price_message' );
    function custom_price_message($price) {
    if(!empty($price)){
    return $price;
    }else{
    return 'Pris efter forespørgsel';
}
}
I am trying to display products without a price as"Price upon request" and i've worked it out to work in my primary language/currency. But when changing to English the currency (EURO) does not apply the desired text.

I followed this documentation and mostly solved the problem.

Add to cart button is gone, but price is still shown as"€0" insted of"Price upon request" as in my primary language.

-> https://currency-switcher.com/make-product-not-purchasable-avoid-free-price-text

-> https://gallerifusion.dk/en/konstantin-korobov-maleri-18/

Found this code on your website: https://currency-switcher.com/faq


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;
}
}


After applying this code in my child theme there is a problem.

Items that are marked as"Sold" on my website by having no price and out of stock now shows as"Price upon request". Items that are zero (0) in stock on my website should show as"Sold", but with the above code all products with"0" price are shown as"Price upon request".

Please modify the code so products without price that are in stock (1) is marked as"Price upon request" and items that are out of stock (0) and without price is still marked as sold :)

Hello

What plugin version number are you using?

Hello,

Version 1.4.1.7

Hello

please try  in file - wp-content\plugins\woocommerce-currency-switcher\classes\woocs.php - add this code  - https://share.pluginus.net/image/i20240212133356.png

if (empty($price)) {
return $price;
}

My code + changing product type to"External/Affiliate product" + your code, solved the problem.

You are the best, thanks for your time! :D

Found my code in Stack overflow: https://stackoverflow.com/questions/47611343/add-text-after-price-unless-the-price-is-zero-then-call-for-price-in-woocommerc

Hello

Great! Welcome;)