このユーザーにはお気に入りのトピックがありません。
開始者:marcelaB-4 カテゴリ:English Support
Dražen
Bigul
marcelaB-4
開始者:marcelaB-4 カテゴリ:English Support クイック解決可能
Problem:
How to create a link for the WooCommerce Google Product Feed plugin to include the multi-currency support for the translated products.
Solution:
Add the following code to the functions.php file of your theme:
add_filter( 'wcml_client_currency', 'modify_client_currency', 10, 1 ); function modify_client_currency( $current_currency ) { if( !is_admin() ){ global $woocommerce; $currency = isset( $_GET['currency'] ) ? esc_attr( $_GET['currency'] ) : $current_currency; $currency = strtoupper( $currency ); $woocommerce->session->set('client_currency', $currency); return $currency; } }
After that, if you use the parameter language URL format add a link like this to the product feed:
website.com/?lang=CODE¤cy=CUR
For the directory mode language URL format:
website.com/CODE/?currency=CUR
Replace CODE with the language code and replace CUR with the currency that you want.
Relevant Documentation:
https://wpml.org/wcml-hook/wcml_client_currency/