If you are having a notice about writing the .mo files please read this doc

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 10 replies, has 2 voices.

Last updated by mehdiI-5 5 months, 2 weeks ago.

Assigned support staff: Riffaz.

Author Posts
May 8, 2019 at 7:24 am #3764317

mehdiI-5

I want to let people choose currency in the first visit, I want something like :

---------------------

Select Currency:
EUR / CAD / USD

Select (button)
---------------------

I hope you can help me with this
Thank You

May 8, 2019 at 8:30 am #3764565

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

You can create the currency switcher as you want by referring this : https://wpml.org/documentation/related-projects/woocommerce-multilingual/designing-custom-currency-switchers-using-template-files/

If you are not sure about editng your php files you may consider : https://wpml.org/contractors/

Hopefully that explain to you.

If you need anything else regarding this let me know.

Regards,
Riffaz.

May 14, 2019 at 6:56 pm #3810061

mehdiI-5

I managed to make the currency switcher with (select) button that changes currency from URL parameter I used this php code :

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 button changes the currency but when you refresh the page or go to another page, the currency goes back to the default one.

Can you please help figure out the issue ?

Here is the website URL: hidden link
You can use this URL: hidden link and refresh the page

Thank you

May 15, 2019 at 10:21 am #3814867

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

That's great. your code is perfect.

The issue currency is auto changing to default should be related to something else.

Temporarily disable your custom currency switcher.
Add the default WCML currency switcher.
Do you still see the issue if you refresh the page?

Regards,

May 15, 2019 at 10:47 pm #3820461

mehdiI-5

No, the default WCML currency switcher works fine.

May 16, 2019 at 6:03 am #3822129

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

I escalated this to 2nd tier support.
Please be patient till we get back to you.

Regards,

May 16, 2019 at 10:42 am #3824999

mehdiI-5

Ok Thanks

May 16, 2019 at 11:29 am #3825553

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

You are welcome.

** updating the status

May 19, 2019 at 10:03 pm #3842625

mehdiI-5

Still waiting!

May 29, 2019 at 1:30 pm #3915973

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

I am sending this to ask again regarding https://wpml.org/forums/topic/how-to-show-currency-code-only-in-the-currency-switcher/#post-3845355

Otherwise this ticket will be closed within two weeks.

Regards,

June 1, 2019 at 7:33 pm #3935817

mehdiI-5

I found a solution on my own.