wcml_geolocation_get_user_country
- Loại
- filter
- Danh mục
- Tính năng đa tiền tệ
- Phiên bản WooCommerce Multilingual
- 4.11.0
Miêu tả
Cho phép ghi đè quốc gia được định vị địa lý của WCML.
Đối số
- $userCountry
- (string) Quốc gia trong địa chỉ thanh toán được sử dụng nếu đã thiết lập, nếu không sẽ là quốc gia được định vị địa lý.
- $allUserCountries
- (array) {
- @key $billing
- (string) Quốc gia của địa chỉ thanh toán
- @key $shipping
- (string) Quốc gia của địa chỉ giao hàng
- @key $geolocation (string) Quốc gia được định vị địa lý
Ví dụ sử dụng
// 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 );
Các hook liên quan
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