Skip Navigation

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

Problem:
You are experiencing an issue with the multi-currency option in WooCommerce when using the Variation Swatches Pro plugin. The currency conversion works correctly for the main product prices, but when changing an attribute variant that affects the price (e.g., color), the additional cost is not converted correctly and adds the same numeric value in a different currency.
Solution:
Step 1: Verify Plugin Compatibility
Ensure that you are using the latest versions of both WPML, WooCommerce, and the Variation Swatches Pro plugin. Compatibility issues often arise from outdated versions.
Step 2: Check WPML Multicurrency Settings
1. Go to WPML > WooCommerce Multilingual & Multicurrency > Multicurrency.
2. Ensure that the conversion rates are set correctly for all currencies.
3. Verify that the settings for rounding and display are appropriate for your needs.
Step 3: Verify Attribute Pricing
1. Go to Products > Attributes in the WordPress admin panel.
2. Ensure that the attribute prices are set correctly in the primary currency (PLN).
Step 4: Custom Code Adjustment
Sometimes, custom code is required to ensure compatibility between different plugins. You might need to add a custom filter to handle the price conversion for attribute variants correctly. Here is an example code snippet that you can add to your theme's `functions.php` file:

add_filter('woocommerce_product_variation_get_price', 'convert_variation_price', 10, 2);<br />add_filter('woocommerce_product_variation_get_regular_price', 'convert_variation_price', 10, 2);<br />add_filter('woocommerce_product_variation_get_sale_price', 'convert_variation_price', 10, 2);<br /><br />function convert_variation_price($price, $variation) {<br />    if(function_exists('wcml_is_multi_currency_on') && wcml_is_multi_currency_on()) {<br />        $price = apply_filters('wcml_raw_price_amount', $price);<br />    }<br />    return $price;<br />}

Step 5: Contact Plugin Support
Since "Variation Swatches Pro" is not listed in our directory of compatible plugins, we recommend reaching out to their support team. They may have specific solutions or patches for this known issue.

If this solution does not resolve your issue or seems irrelevant, we highly recommend checking related known issues at https://wpml.org/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 at WPML 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 1 reply, has 2 voices.

Last updated by Mihai Apetrei 7 months, 1 week ago.

Assisted by: Mihai Apetrei.

Author Posts
July 11, 2024 at 1:29 pm #15935339

tomaszK-56

Background of the issue:
I am experiencing an issue with the multi-currency option for WooCommerce. The currency conversion works correctly for product prices. However, we are also using the Variation Swatches Pro plugin, and here we encounter a problem because it converts currency 1 to 1. For example, our main currency is PLN, and for the English language, we use EUR. For the "main" price, everything works correctly, but when we change an attribute variant (which increases the price, e.g., red color + 15 PLN), instead of converting this value, it adds 15 EUR to the price. In the WordPress admin panel, I am unable to change these values because they are "locked" and uneditable.

Symptoms:
When changing an attribute variant, the price increase is not converted correctly and adds the same numeric value in a different currency.

Questions:
Do you have a solution for the currency conversion issue with the Variation Swatches Pro plugin?

July 15, 2024 at 3:05 pm #15955216

Mihai Apetrei
Supporter

Languages: English (English )

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

Hi Tomasz,

Thank you for your amazing patience.

I understand what you're looking for. Please note that the plugin you've mentioned (Variation Swatches Pro) is not listed in WPML's compatible plugin directory. You can verify this yourself from this link: https://wpml.org/plugin/

Therefore, I don't have information on whether the plugin has been tested for compatibility with WPML.

Here are a few steps that I prepared though that might guide you in the correct direction and help you find a solution that works for your case.

Step 1: Verify Plugin Compatibility
Ensure that you are using the latest versions of both WPML, WooCommerce, and the Variation Swatches Pro plugin. Compatibility issues often arise from outdated versions.

Step 2: Check WPML Multicurrency Settings
1. Go to WPML > WooCommerce Multilingual & Multicurrency > Multicurrency.
2. Ensure that the conversion rates are set correctly for all currencies.
3. Verify that the settings for rounding and display are appropriate for your needs.

Step 3: Verify Attribute Pricing
1. Go to Products > Attributes in the WordPress admin panel.
2. Ensure that the attribute prices are set correctly in the primary currency (PLN).

Step 4: Custom Code Adjustment
Sometimes, custom code is required to ensure compatibility between different plugins. You might need to add a custom filter to handle the price conversion for attribute variants correctly. Here is an example code snippet that you can add to your theme's `functions.php` file:

php
add_filter('woocommerce_product_variation_get_price', 'convert_variation_price', 10, 2);
add_filter('woocommerce_product_variation_get_regular_price', 'convert_variation_price', 10, 2);
add_filter('woocommerce_product_variation_get_sale_price', 'convert_variation_price', 10, 2);

function convert_variation_price($price, $variation) {
    if(function_exists('wcml_is_multi_currency_on') && wcml_is_multi_currency_on()) {
        $price = apply_filters('wcml_raw_price_amount', $price);
    }
    return $price;
}

Please note that custom coding falls outside the scope of our support policy, and we cannot guarantee that it will work. This is just a recommendation to help guide you in the right direction.

In case you need a custom solution, I recommend hiring a WPML contractor (https://wpml.org/contractors) or a developer of your choice.

Step 5: Contact Plugin Support
Since "Variation Swatches Pro" is not listed in our directory of compatible plugins, I recommend reaching out to their support team. They may have specific solutions or patches for this known issue.

I hope that you will find this information helpful.

Mihai Apetrei