wcml_geolocation_get_user_country
- ประเภท
- filter
- หมวดหมู่
- ฟีเจอร์หลายสกุลเงิน
- เวอร์ชันของ WooCommerce Multilingual
- 4.11.0
คำอธิบาย
อนุญาตให้แทนที่ประเทศที่ระบุจากตำแหน่งที่ตั้งของ WCML
อาร์กิวเมนต์
- $userCountry
- (สตริงข้อความ) ที่อยู่สำหรับเรียกเก็บเงินจะถูกนำมาใช้หากมีการตั้งค่าไว้ มิฉะนั้นจะใช้ประเทศจากตำแหน่งทางภูมิศาสตร์
- $allUserCountries
- (array) {
- @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