Please make sure to update to WPML 4.3.4 before reporting any issue

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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.

This topic contains 9 replies, has 2 voices.

Last updated by Bruno 1 year ago.

Assigned support staff: Bruno.

Author Posts
September 20, 2018 at 1:21 pm #2752276

saehoonK

Hi,

I followed your snippet in regards to https://wpml.org/forums/topic/currency-url-parameter-issue/.

add_action( 'wcml_client_currency', 'currency' );
function currency( $current_currency ) {

    if( !is_admin() ) {

        global $woocommerce;
        global $sitepress;

        $currency = isset( $_GET['currency'] ) ? esc_attr( $_GET['currency'] ) : $current_currency;
        $currency = strtoupper( $currency );

        $woocommerce->session->set('client_currency', $currency);

        return $currency;
    }
}

The code doesn't give a URL parameter for the currency.

Please help!

September 21, 2018 at 1:52 pm #2755360

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi,

Thank you for contacting us.

This code should be for you to call the URL with the currency code, manually. For example: site.com/shop/?currency=eur. That is, the currency code is not automatically added.

In the currency code above, the products should be priced in euros (EUR). By testing that I did this code still works correctly for that purpose.

Please, let me know if I can help with any other questions you may have. I'll be happy to help.

Thank you.

September 22, 2018 at 12:26 pm #2757409

saehoonK

Hi,

Please watch the following video:
hidden link

First off, if you see the address there is no currency parameter.

Secondly, the text link to .../?currency=usd doesn't work properly. You can see it in the video.

Thanks.

September 24, 2018 at 2:14 pm #2760745

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Thanks for the video. I tried to access your site to view the problem but I could not. You will need to test a few things to see if the problem persists:

- Disable all non-WPML plugins (keep the WooCommerce and WooCommerce Multilingual)
- Switch to the default theme (remember to add the above code in the default theme as well)
- Clear all caches for your site

Unfortunately, I can not access your site to test and check if there is any problem with the cache. An error message is displayed and the site does not open.

After following the steps above, please let me know if the problem persists.

Thank you.

October 4, 2018 at 12:32 pm #2787495

saehoonK

I'm sorry the server was temporary out.
It's back on now.
I followed your step to check the issue and it still persists.

For example, I clicked a direct link ../checkout/?currency=usd, I got the ../checkout/?currency=usd in the browser address bar and the currency switch menu changed to USD.
And I want to back to EUR. So if I select the EUR at the currency switch menu, The browser still have ../checkout/?currency=usd in the browser address bar. So, I can not switch back to USD again.

Thanks.

October 4, 2018 at 9:47 pm #2788853

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Thank you for the explanation. This still seems to be a problem either with your theme or with some cache that you may be using on the checkout page. Testing this on the product page works correctly:

- KRW: hidden link
- USD: hidden link

You should check why this custom coding is not being applied to the checkout page. Please note that as this is about custom coding, this is beyond the scope of our support.

We have a list of WPML and WooCommerce Multilingual hooks that can help you develop such feature, which can be seen in the links below:

- https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference
- https://wpml.org/documentation/related-projects/woocommerce-multilingual/wcml-hooks-reference/

If you prefer, you can contact one of our certified partners who can develop small to large features for your site: http://wpml.org/documentation/support/wpml-contractors/

Thank you.

October 17, 2018 at 3:58 pm #2825263

saehoonK

The parameter is working well itself.
The problem is when you change the currency by using the currency switch, it won't work.
For example,
URL: hidden link
If you change EUR currency using the currency switch, it still remain the EUR currency after loading.

Regards,

October 18, 2018 at 1:48 am #2826126

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

This is because the URL parameter makes when the page loads, the price is displayed in the chosen currency (which is in the URL).

As I explained above, this is still about custom coding. You will need to do this in a way that after the page is loaded removes the "currency" URL parameter (for example, redirect). That way, when the page loads using the currency selector, the "currency" parameter will not force the selected currency in the URL.

At the moment, if the "currency" parameter is added, when you use the currency selector, again the "currency" parameter persists in the URL and keep the price.

Thank you.

October 21, 2018 at 12:48 pm #2835559

saehoonK

Bruno,

I don't understand why this feature is beyond your support.
This feature is so related to switching languages.
I hope you add this feature to your instruction.

Thanks.

October 22, 2018 at 2:38 pm #2838459

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

This feature is beyond our support because we natively do not support what you want to do and therefore you need custom coding.

For this reason, the custom coding is beyond our support. Our support is about the default features that WPML already provided (without the creation of custom coding).

Currently, the feature that WPML offers is to switch the language with AJAX (not the URL), which is the default WooCommerce Multilingual selector. From what I've noticed, this is working properly, as expected.

As I posted above, we have a list of WPML and WooCommerce Multilingual hooks that can help you develop such feature, which can be seen in the links below:

- https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference
- https://wpml.org/documentation/related-projects/woocommerce-multilingual/wcml-hooks-reference/

If you prefer, you can contact one of our certified partners who can develop small to large features for your site: http://wpml.org/documentation/support/wpml-contractors/

Thank you.