Woocommerce - Remove country field in cart shipping

后端 未结 3 1719
生来不讨喜
生来不讨喜 2020-12-18 06:50

How would I have Australia selected by default and have the input field not displaying heres an example of what im talking about I am using woocommerce:

相关标签:
3条回答
  • 2020-12-18 07:12

    Paste following code into your function.php file to Remove country field in checkout page:

    function custom_override_checkout_fields( $fields )    
    {
    unset($fields['billing']['billing_country']);
    return $fields;
    }
    add_filter('woocommerce_checkout_fields','custom_override_checkout_fields');
    
    0 讨论(0)
  • 2020-12-18 07:19

    You can set your store to only sell to Australia in the WooCommerce Settings> General Settings in the "Specific Countries" field

    restrict the countries you will sell to

    This should remove the Country option from the checkout. With "Australia" set in the above settings here is the result in Twenty Fourteen:

    checkout with no country option

    0 讨论(0)
  • 2020-12-18 07:23

    A bit late but still for those who looking for correct answer

    // Remove Country field from shipping calculator
    add_filter('woocommerce_shipping_calculator_enable_country','__return_false');
    
    0 讨论(0)
提交回复
热议问题