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

Last updated by Noman 1 year, 5 months ago.

Assigned support staff: Noman.

Author Posts
May 10, 2018 at 6:15 pm #2078109

tsahiR

Hello,

In PHP, I would like to know how to do something if currency is set to X

For example, if currency is usd, echo hello

This seems simple enough, can anyone please help me do this?

Thanks in advance!

Tsahi

May 11, 2018 at 7:46 am #2082877

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. You can use following function to get current currency:

$current_currency = get_woocommerce_currency();

Here is doc for more details:
hidden link

Thank you

May 11, 2018 at 8:24 am #2083515

tsahiR

Hi,

Thanks for your response.

I am aware of this method to get current currency.

However this is not what I am looking for.

I'm looking for something like this:

if (currency=usd) {echo 'test';}

Thank you in advance for looking into this specific question.

-Tsahi

May 11, 2018 at 11:06 am #2087232

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Sorry, for misunderstanding. I have added following code in my header.php file for testing.

$current_currency = get_woocommerce_currency();
if($current_currency == 'USD') {
	echo 'test ';
}

it printing ‘test’ because my current currency is usd.
If this is not what you are looking for, Can you please give me more details.

Thank you

The topic ‘[Closed] Specific Functions If Currency Is X’ is closed to new replies.