WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Impossible to make billing Postcode not required (8 posts)

  1. ponch
    Member
    Posted 10 months ago #

    I need to make the Postcode field in Billing address NOT required, but it's impossible. I tried code in functions.php, nothing happens. I bought the Custom Shipping Options plugin for $40. It allow to uncheck the fields which you dont want to be "required". Works on all fields but the billing Postcode stays "required". I've tried everything. It's stuck required. How to make it unrequired?

    http://wordpress.org/plugins/woocommerce/

  2. Teresa In
    Member
    Posted 10 months ago #

  3. ponch
    Member
    Posted 10 months ago #

    I am using this plugin. It's impossible to remove "required" mark from "billing postcode". Try yourself. It just stays in place.

  4. Teresa In
    Member
    Posted 10 months ago #

    ...then you have to create a hook
    there are a example Make phone number not required

    I'm not a programmer, I guess it could be ...

    //Hock
    add_filter( 'woocommerce_billing_fields', 'billing_postcode' );
    
    function billing_postcode( $address_fields ) {
    $address_fields['billing_postcode']['required'] = false;
    return $address_fields;
    }
  5. ponch
    Member
    Posted 10 months ago #

    No, stays on place.

  6. ponch
    Member
    Posted 10 months ago #

    I tried this code in functions.php + in plugin Customize Checkout Options (paid $40 for it) the "required" field for Billing Zipcode is unchecked + I erased update_totals_on_change in Postcode options, still it has red mark and is required.

    Anyone can explain why?

    I'm using to methods of delivery - all the country and local.
    I disabled shipping fields and use billing as the address. Locals dont need and dont remember their postcode, so I need to make it non-required. But cant.

  7. Teresa In
    Member
    Posted 10 months ago #

    ...the hook has to go in the functions.php file of the theme
    I've tried it and the red mark disappears

  8. Andrew Rowland
    Member
    Posted 1 month ago #

    You need to use woocommerce_default_address_fields for the postcode.

    //Hock
    add_filter( 'woocommerce_default_address_fields', 'billing_postcode' );
    
    function billing_postcode( $address_fields ) {
    $address_fields['billing_postcode']['required'] = false;
    return $address_fields;
    }

Reply

You must log in to post.

About this Plugin

About this Topic