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

Unable to round cents to 0.99, 0.50 or 0.95 when switching currencies

This support system is for all types of the plugins as for premium versions, so for free ones! If you have premium version do not forget in the private data of the request (!!not in the text of the support request!!) after its publishing insert purchase code please (see blue-green button on the right side) and press Save button.
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.
12

Hello!

I tried adding the following code to the functions.php file in Theme but no changes when I switch currencies. Ideally I want the price to end with $0.95/£0.95 etc, but tried testing it with the below code and it didn't work anyway.

2
3
add_filter('woocs_raw_woocommerce_price', function($price) {
    return round($price + 0.01)0.01;
});

I appreciate your help on this! I'm using Themify theme if that helps or not.

Cheers!

Hello

In which file(name) did you insert this code

Please  drop me  exact  link to the issue

Hi Pablo,

I copied and pasted the above code into this:

Image
(https://tarotemporium.com.au/supportcurrency/) <-temporary image

Hi Pablo,

Do you have any suggestions? I understand support tickets are not reviewed over weekends but I've been having issue with this for 4 days now. I'm really looking for a currency switcher/converter for my e-commerce site and definitely want this to work and upgrade to the paid version to include more currencies.
I just can't get this to work, I looked at all support pages and copy & paste the code into the functions.php, to see no changes. I want all currencies (GBP, AUD, CAD, USD, Euro) to end with .95 eventually but even testing with the below doesn't work.

add_filter('woocs_raw_woocommerce_price', function($price) {
    return round($price + 0.01)0.01;
});

Thank you!

Hello

Add  this  code  to  functions.php:

add_filter('woocs_raw_woocommerce_price', function($price){
return round($price-0.01) - 0.05;
});
add_filter('woocs_woocommerce_variation_prices', function($price){
return round($price-0.01) - 0.05;
});

Please  drop  me  exact  link to  the  issue(the  page  with  products)

Thanks Paulo, I think it worked by defaulting products to $XX.95. However, when I switched from AUD to USD, back to AUD, it doesn't change back into AUD or flat, the amount doesn't change.

(https://tarotemporium.com.au/shop/bags/test-product/)

After you change currencies, it doesn't update the flat/currency.

Testing on mobile (iOs - Safari) is where I am experiencing the most issues. For some reason it's defaulting in USD (not AUD where I am located), it doesn't change to AUD when I select, and the flags/currency doesn't update.

[EDIT] I purged all the cache, re-open the site and it's defaulting at AUD. I change the currency to USD, the price changes but not the flag, still showing in AUD. However, when you change back to AUD, the price doesn't change and is stuck at USD amount.

https://tarotemporium.com.au/shop/bags/test-product/

Hello

Please check  options  - https://share.stackovergo.com/image/i20210714114446.png

Hi Pablo, I went into my settings and changed everything to the options you provided. When I switch to say USD, the currency changes but still says AUD at the top. Please advise.

I also tested on Chrome after I purged the cache and nothing happens (no change of currency or flag, stays on AUD).

My  test -  https://c2n.me/4cGLCKd

And  please  use  correct  currency  codes(https://share.stackovergo.com/image/i20210714124324.png) - USD and AUD without $

Hi Pablo,

I have now upgraded to the Pro version and unable to see Euro update when I change currencies (shows as $0.00).
https://tarotemporium.com.au/shop/bags/test-product/

And in terms of Japanese Yen, are you able to provide a code where the cents will round to .00 and all the other currencies end 0.95?

Apologies, looks like Euro has updated on it's own.

However, still have issue with JPY.

Hello

Please  check  the  rate. It shouldn't be zero

Hi Pablo, thank you.

Now when I select any currency, it doesn't update.

And in terms of Japanese Yen, are you able to provide a code where the cents will round to .00 and all the other currencies end 0.95?

Hello

Now when I select any currency, it doesn't update. - My  test - https://c2n.me/4d213lc

Japanese Yen - This currency has no cents.  For other currencies, you use the rounding code. Send me this code

Hi Pablo, thank you!

Japanese Yen is now showing on my website.

I have another question.. on physical products I want the price to be XX.95 (to which it's showing).

However, on virtual products/services I would like the price to be $60.00.

Is there a way to split products this way?

Hello

Unfortunately no. Because there is no way to get product information inside these hooks

Hi Pablo,

Looking at the code, is there not a way to add product category or something to that degree? I'm not a programmer but something like:

add_filter('woocs_raw_woocommerce_price',function wpb_catlist_desc(subscription), function($price){
return round($price-0.01) - 0.05;
});
add_filter('woocs_woocommerce_variation_prices', function wpb_catlist_desc(subscription), function($price){
return round($price-0.01) - 0.05;
});

My programming knowledge is really lacking but using the above as an example.

12