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

Switch of WOOCS for one product only

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.

Hello, I want to switch off the currency conversion for one product only.

 

We have one product in our shop which should be 1990 in EUR and USD, ignoring the actual exchange rate. All other products should not be affected by this (so a fixed 1:1 exchange rate in the settings is not an option).

 

It should also be changed (not automatically converted) in the database forever since another plugin (pricing and discounts) needs to take the 1990 I'm EUR and USD as well.

 

How can I do this? Hardcoding via the product ID is totally okay, it doesn't need to be very sophisticated. Just for this one product only and forever.

 

Best regards

Michael

Hello Michael

it is possible to do it but only on the single  product page. An  example:

add_filter('wp_head',function(){    
    if(is_product()){
       global $product;
       $id = $product->get_id();
       if ($id!= X){
          return;
       }
       global $WOOCS;
       $WOOCS->set_currency('EUR'); 
     }
 });

Hello Pablo,

thank you for your answer.

For the frontend display we don't have any issue.

Our issue is that the 'real' price from the database is taken by the bulk purchase plugin. Is there however any possibility to disable the plugin for this one product so it wouldn't alter the price in USD and EUR in the database?

Best Regards

Hello

All prices must be stored in only one currency

Unfortunately my plugin does not have this feature.

Okay, I understand that the plugin doesn't have the feature build in.

But could you hint me where (which file) I could hardcode and exclude the plugin for one product?

hello

How my plugin works: Prices are stored in the base currency in the database. My plugin does not change this and does not affect it in any way.

before displaying the product, my plugin intercepts the prices and converts them on the fly

in file - \wp-content\plugins\woocommerce-currency-switcher\classes\woocs.php - function - raw_woocommerce_price

I got it I think.

At the top of the function

raw_woocommerce_price 

I simply put

//exclude one product from currency conversion
$id = $product->get_id();
if($id == XXX OR $id == XXX) {
return$price;
}

Where XXX is the product id of your WooCommerce product.

That does the trick for me. Maybe this helps someone else with the similar issue.

Hello

Thank you for your cooperation

Welcome;)