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

Last updated by Shekhar Bhandari 1 year, 4 months ago.

Assigned support staff: Shekhar Bhandari.

Author Posts
June 26, 2018 at 1:29 pm #2435376

Bruno Antunes Luis

Hello,
I'm trying to get the product price for each currencies in function.php.

Also tried without success to implement: https://wpml.org/forums/topic/wcml_product_price_by_currency-returns-id-insted-of-price/

If there another option/solution I can use?

Many thanks in advance for your help.

Hope you're doing well.

Have a nice day.

June 28, 2018 at 9:54 am #2440565

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Thank you for contacting WPML support. I'd be happy to assist you further on this issue.

I am discussing this questions with our 2nd tier supporters and will respond to you soon.

Thanks

July 2, 2018 at 7:50 am #2450071

Bruno Antunes Luis

Hello, did you managed to have a look at my problem by any chance? Many thanks in advance. Hope you're doing well. Have a nice day. Best, Bruno

July 2, 2018 at 10:05 am #2452919

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

I can confirm that the code provided is not working, so in order to better help, I have escalated this issue to our 2nd tier supporter and one of the 2nd tier supporters will respond to you soon.

Thanks

July 3, 2018 at 7:29 am #2455826

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Our 2nd tier provided a feedback on this issue and they mentioned that you should use the following code to retrieve the results

add_action( 'admin_init', 'test' );
function test() {
global $woocommerce_wpml;
$price = $woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( 29, 'USD' ); //Assuming if secondary currency is USD and product ID is 28
};

You should use the function in the admin_init action to make it work.

Let me know if this helps.

Thanks

July 3, 2018 at 7:38 am #2455853

Bruno Antunes Luis

Hello Shehar,
So it's not possible to get this information inside "woocommerce_rest_prepare_product_object" for instance?
Thanks for your support. Much appreciated.
Hope you're doing well. Have a nice day.

July 3, 2018 at 8:31 am #2456115

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

I am not totally sure if you can use this inside the hook you mentioned, you can give it a try further I also received an information from the 2nd tier that you can also get the currencies with the following code, which doesn't require any admin_init action.

global $woocommerce_wpml;
$multi_currency = $woocommerce_wpml->get_multi_currency();
$multi_currency->prices->prices_init();
$price = $multi_currency->prices->get_product_price_in_currency( 29, 'AED' )

Let me know if this helps.

Thanks