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

Currency conversion wrong on cart page

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.
12

Hello,

I just bought the premium plugin yesterday,  my Basic currency is MUR and I have 2 additional currencies: USD & EUR.

After adding a product to cart, the converted currency displayed on the cart page is wrong for both USD & EUR (See below screenshot on the provided link)

https://tamarindleafyoga.com/wp-content/uploads/2021/03/screenshot_20210322.png

The product is I am testing is the following: https://tamarindleafyoga.com/product/starter-plan/

After some internet search, I tried to add the code snippet below but in vain, the issue is still present.

//We are reversing the price of product to MUR in cart page, because the rate is applied again there
add_action('woocommerce_before_calculate_totals', 'fix_currency_conversion');
function fix_currency_conversion($cart_object){
global $WOOCS;
$cur_currency = $WOOCS->current_currency;
$currencies = $WOOCS->get_currencies();
$conversion_rate = $currencies[$WOOCS->current_currency]['rate'];
if($cur_currency == 'USD'){
foreach ( $cart_object->cart_contents as $cart_item_key => $cart_item ) {
$cart_item['data']->set_price($cart_item['data']->price / $conversion_rate);
}
}
}

 

Sources:

https://wordpress.org/support/topic/currency-conversion-is-wrong-in-cart-page/

https://stackoverflow.com/questions/60641547/currency-conversion-by-plugin-is-wrong-in-cart-page

 

Can you please advise?

Thanks and regards,

Ajit M.

 

 

Hello Ajit

This is an incompatibility with a third party plugin( in your case a subscription plugin )

Read  this  please - https://currency-switcher.com/woocs-labs/

Hi Pablo,

Thank you for your reply. I am indeed using the YITH WooCommerce Subscription plugin and unfortunately there is currently no fix available for it on the link you provided. The followings are the only YITH plugin fixes available.

  1. YITH Donations for WooCommerce Premium 1.0.14
  2. YITH WooCommerce Account Funds
  3. YITH WooCommerce Color and Label Variations
  4. YITH WooCommerce Deposits and Down Payments
  5. YITH WooCommerce Dynamic Pricing and Discounts
  6. YITH WooCommerce Name Your Price Premium
  7. YITH Woocommerce Points and Rewards
  8. YITH WooCommerce Product Add-Ons
  9. YITH WooCommerce Role Based Prices

 

[WOOCS LABS]

Can you please consider a request to create an adaptation script for the YITH WooCommerce Subscription plugin?

This plugin is vital for me and I don't have any other way around it.

Thanks and regards,

Ajit M.

 

Hello Ajit

Sure!  Please  add  wp-admin +FTP  access to your test  site - https://c2n.me/43SC6rb.png -> https://c2n.me/42BAoj4.png

I'll add this to the adaptation queue

Hi Pablo,

The credentials requested have been added to the private area.

Thanks,

Ajit M.

Hello Ajit

If the site alive - create clone of it by https://wordpress.org/plugins/duplicator/ and send me access

Hi Pablo,

I am on a business plan with wordpress.com and hence don’t have hosting space to host a clone.

Even though my site is live, it does not have lots of traffic and wordpress.com does full backup of the site daily, which can be easily rollbacked to if needed.

Please proceed with the adaptation script and while testing, a 5-10 minutes outage is fine provided you quickly rollback the change if you run into issues.

Thank you

Ajit M.

Ok! the problem is that when we do the adaptation, debug information and short server crashes may be output

In that case, please feel free to activate the maintenance page on the site if that helps. There is a maintenance page plugin already installed.

Thanks,

Ajit M.

Hello

ok! I will write to you as soon as we get the result

Hi Pablo,

Do you have any update on the adaptation script?

Thank you

Ajit M.

Hello Ajit

I will write to you when the result is.

as I wrote above, this is a queue for adaptation

Hello Pablo,

Can I have an update about where my request is in the queue? My project being dependent on this currency switching feature, is now stalled for 2 weeks.

Thanks for your understanding.
Ajit M.

Hello Ajit

You are now third in line.

More likely we will customize for you on April 16

Hi Pablo,

Thanks for the update.  I can work with that.

Regards,

Ajit M.

Hello Ajit

In  file -"wp-content\plugins\yith-woocommerce-subscription-premium\includes\class.ywsbs-subscription-cart.php"  add  code - https://c2n.me/4bIZaqg.png

$rate = 1;
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
}
}
}

AND  https://c2n.me/4bIZdQA.png

$rate = 1;
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
}
}
}

AND - https://c2n.me/4bIZgJO.png

$rate = 1;
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
}
}
}

In  file -"\wp-content\plugins\yith-woocommerce-subscription-premium\includes\class.ywsbs-subscription-synchronization.php" - add  code - https://c2n.me/4bIZnpr.png

$rate = 1;
if (class_exists('WOOCS')) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
}
}
}

 

And  do  a test

Hi Pablo,

I made all the changes as you requested.

I noticed an improvement, however on the Cart & Checkout pages, when I switch the currency there, it remains with the 1st chosen currency. This is not expected. Customers should be able to change the currency on the Cart & Checkout pages as well.

Please see screenshot: https://tamarindleafyoga.com/wp-content/uploads/2021/04/screenshot-cart_20210417.jpg

The Recurring totals is not consistent with the Total and Subtotal numbers.

Please advise.

Thanks and regards,

Ajit M.

Hello

Ok!  I will  check it

Hi Pablo,

Do you have any update?

Thanks,

Ajit M.

Hello

The developer will check this on Friday.

 

12