WPML
wcml_geolocation_get_user_country
タイプ
filter
カテゴリー
多通貨機能
WooCommerce Multilingualバージョン
4.11.0

説明

WCMLのジオロケーションによる国の上書きを許可します。

引数

$userCountry
(文字列) 設定されている場合は請求先住所、それ以外の場合はジオロケーションによる国。
$allUserCountries
(配列) {
@key $billing
(文字列) 請求先住所の国
@key $shipping
(文字列) 配送先住所の国
@key $geolocation
(文字列) ジオロケーションによる国
}

使用例

// Always use the shipping address if it's available
add_filter( 'wcml_geolocation_get_user_country', function( $userCountry, $allCountries ) {
    return ! empty( $allCountries['shipping'] ) ? $allCountries['shipping'] : $userCountry;
}, 10, 2 );

wcml_custom_prices_fields_labels, wcml_is_cache_enabled_for_switching_currency, wcml_user_store_strategy, wcml_rounded_price, wcml_currencies_without_cents, wcml_product_custom_prices, wcml_custom_prices_strings, wcml_switch_currency, wcml_custom_prices_fields, wcml_multi_currency_ajax_actions

すべての多通貨機能フック(24件) →