Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Bobby 1 year, 3 months ago.

Assisted by: Bobby.

Author Posts
August 14, 2023 at 2:56 pm #14197971

tannerT

When both plugins are enabled, these errors are received (See attached screenshot)

August 14, 2023 at 3:33 pm #14198327

tannerT

I have fixed the issue for your developers. The problem is within:
woocommerce-multilingual/inc/class-wcml-cart.php in "public function convert_cart_shipping_to_currency" on line 649. Here is the complete function BEFORE resolution:

public function convert_cart_shipping_to_currency( $currency ) {
$shipping_amount_in_default_currency = $this->woocommerce_wpml->multi_currency->prices->unconvert_price_amount( WC()->cart->get_shipping_total() );

return $this->woocommerce_wpml->multi_currency->prices->convert_price_amount( $shipping_amount_in_default_currency, $currency );
}

Here is the NEW WORKING code:

public function convert_cart_shipping_to_currency( $currency ) {

// Check if 'wp_loaded' has already fired.
if ( did_action( 'wp_loaded' ) ) {
// 'wp_loaded' has already happened, so we can safely process the cart.
return $this->get_converted_shipping_amount( $currency );
} else {
// Defer the processing until after 'wp_loaded'.
add_action( 'wp_loaded', function() use ( $currency ) {
return $this->get_converted_shipping_amount( $currency );
} );
}
}

private function get_converted_shipping_amount( $currency ) {
$shipping_amount_in_default_currency = $this->woocommerce_wpml->multi_currency->prices->unconvert_price_amount( WC()->cart->get_shipping_total() );
return $this->woocommerce_wpml->multi_currency->prices->convert_price_amount( $shipping_amount_in_default_currency, $currency );
}

You can shout me out in the next update, thx

Screenshot 2023-08-14 at 10.33.39 AM.png
August 14, 2023 at 4:00 pm #14198669

tannerT

I have modified the code further. You can disregard the above. This is likely a temp fix and I am sure your developers have a better manner to fix this but please escalate immediately!

August 15, 2023 at 7:53 pm #14205219

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi there,

Thank you for sharing the above code and input, I will make sure to pass this along to the right team, however, first if possible I would like to understnad the issue you are experiencing.

The screenshot you shared was never uploaded.

Please share with me the error you receive and the action the reproduces this error.

August 15, 2023 at 8:14 pm #14205241

tannerT

Feel free to pass this onto the developers and have them install/activate both plugins. This is very easy to replicate and I encourage you to fix ASAP