R
R
Roman Savitsky2019-04-05 14:38:22
WooCommerce
Roman Savitsky, 2019-04-05 14:38:22

How to get currency of current language in wpml + woocommerce site?

Hello. I was puzzled by one question in the internet, I do not find a solution.
There are two languages ​​in the store English and German, and respectively two currencies $ and €.
When switching from English to German, the price of the product changes from $ to € .
I put the goods in the basket, everything is ok, then I want to load them via Ajax add. goods receiving the ID of the goods through get_cross_sell_ids().
Next do:

global $woocommerce_wpml;
$_product = wc_get_product( $product_id );
$currency_symbol = get_woocommerce_currency_symbol( $woocommerce_wpml->multi_currency->get_client_currency() );
$price = $woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $product_id, '' );

Но $currency_symbol и $price отображают евро на немецком, если пользователь авторизован.
$_product->get_price_html() - Всегда отображает $, хотя выбран немецкий язык на сайте

Actually, the question itself is how to get the price and currency in € of a product, knowing the ID of its German translation, if the user has currently selected German and not English on the site and the user is not authorized?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2019-04-05
@azerphoenix

Hello!
https://wpml.org/documentation/related-projects/wo...
https://ru.wordpress.org/plugins/woo-multi-currency/
https://shopitpress.com/blog/woocommerce-setup/ woo...
https://woocommerce.com/products/multi-currency/
Have you looked at these links by any chance?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question