What I\'m NOT trying to do:
Code I\'ve written:
// NOT WORKING! SHOWS ALL Selling Location(s) (allowed countries)
function override_checkout_fields( $fields ) {
    $fields[\'shipping\'][\'shipping_country\'] = array(
        \'type\'         => \'country\',
        \'label\'        => __( \'Country / Region\', \'woocommerce\' ),
        \'required\'     => true,
        \'class\'        => array( \'form-row-wide\', \'address-field\', \'update_totals_on_change\' ),
        \'autocomplete\' => \'country\',
        \'priority\'     => 40,
        \'options\'      => array( $user_country_code => __( $user_country_name, \'woocommerce\' ) )
    );
    
    //Same for billing_country...
    
    return $fields;
}
add_filter( \'woocommerce_checkout_fields\' , \'override_checkout_fields\', 10, 1 );
// NOT WORKING! SHOWS ALL Selling Location(s) (allowed countries)
function edit_billing_fields( $fields ) {
    $fields[\'billing\'][\'billing_country\'] = array(
        \'type\'         => \'country\',
        \'label\'        => __( \'Country / Region\', \'woocommerce\' ),
        \'required\'     => true,
        \'class\'        => array( \'form-row-wide\', \'address-field\', \'update_totals_on_change\' ),
        \'autocomplete\' => \'country\',
        \'priority\'     => 40,
        \'options\'      => array( $user_country_code => __( $user_country_name, \'woocommerce\' ) )
    );
    return $fields;
}
add_filter( \'woocommerce_billing_fields\', \'edit_billing_fields\' );
... And more
NOTE: 如果我改变
\'type\' => \'country\' 通过
\'type\' => \'select\' 这是可行的,但如果我更改了国家(显示两个国家进行测试),则状态下拉列表不会更新新选定国家的状态。此外,将显示下拉列表,但不显示Select2 Appearence。
Further Explanation:我现在向28个国家销售。例如,如果用户从法国访问web,当用户到达结账表时,我只想让您将产品发送到法国。这就是为什么我想在(计费/发货)国家/地区下拉列表中仅显示用户国家/地区(以前地理位置)。
我会感谢你的帮助!谢谢