Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is trying to change the currency from MXN to USD on the checkout page. They attempted to use custom code methods to update the currency cookie and filter the client currency, but neither method worked.

Solution:
We recommend using the currency switch options provided by WooCommerce Multilingual, which are compatible with payment gateways like WooCommerce PayPal Payments, Stripe, and direct bank transfer. For more information, please refer to our documentation on multi-currency support in WooCommerce.

If the provided solution does not work because the payment gateway is not supported, the client may need to develop custom code to change the currency before checkout. We do not offer support for custom coding through our forum, but we have a network of third-party contractors who specialize in custom projects with WPML. You can find a list of them here: WPML Contractors.

Please note that the solution provided might be irrelevant if it's outdated or not applicable to your case. If this is the situation, we highly recommend checking related known issues at WPML Known Issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket in our support forum.

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 3 voices.

Last updated by Bobby 1 year, 1 month ago.

Assisted by: Bobby.

Author Posts
April 22, 2024 at 12:44 pm #15550494

cameronC-5

Tell us what you are trying to do?
I want to change my Mexico currency MXN to USD when checkout .

Is there any documentation that you are following?
i see example which say it will apply when in Multicurrency payment tab - > any currency -> active toggle button payment gateway then i can change currency as default MXN to USD? how can i do this?
Is there a similar example that we can see?
yes define in previous answer

What is the link to your site?
hidden link

Payment Gateways Not Supported issue..PNG
April 22, 2024 at 1:57 pm #15551029

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support. While you are waiting for one of my colleagues to take this ticket and work on it, let me provide you with the first debugging steps and try to help with the issue quickly.

This option from WooCommerce Multilingual is compatible with WooCommerce PayPal Payments, Stripe, and direct bank transfer.

- https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/

As it says in the image shared, it is not supported. The best I can suggest is developing a custom code that changes currency before checkout to the supported one, or the one you wish to use.

Hope this helps.

Regards,
Drazen

April 22, 2024 at 2:50 pm #15551467

cameronC-5

Yes i already try some custom methods but all failed. when on checkout page after fill form . applications cookies are refresh automatically Again USD to MXN again? when i use this Method !

Method 1:

add_action('woocommerce_before_checkout_form', 'update_wcml_client_currency_cookie');

function update_wcml_client_currency_cookie() {
// Check if the user is on the checkout page
if (is_checkout()) {
// Check if the current currency is MXN and wcml_client_country is 'MX'
if (get_woocommerce_currency() == 'MXN' ) {
// Set the cookie value to 'USD'
setcookie('wcml_client_currency', 'USD', time() + 3600, '/');
}
}
}

This is also not applied correctly?

Method 2:
add_filter( 'wcml_client_currency', 'modify_client_currency', 10, 1 );

function modify_client_currency( $currency ) {
$checkoutpage = wc_get_page_id( 'checkout' );
$current_page_id = get_queried_object_id();

if ( $current_page_id == $checkoutpage && $currency == 'MXN' ) {
return 'USD';
} else {
return $currency;
}
}

Both are not able to solve my issues.

please help and Provide some authentic solution which help to resolve the issue Help to convert MXN to USD when Checkout .

April 23, 2024 at 12:38 am #15553306

Bobby
WPML Supporter since 04/2015

Languages: English (English )

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

Hi there,

Unfortunately, we do not provide support for custom work through this forum. However, we have a network of 3rd party contractors specializing in custom projects with WPML.

You can find a list of them here:
https://wpml.org/contractors/