Home Contact Us Payments SC Commerce SC Commerce Docs SC Commerce Snippets

Simply Computing

We make websites. Simple.

Change postcode/zipcode from required to optional

In some countries postcode/zipcode may be unavailable or not used. This code changes the postcode/zipcode fields from required to optional.

* Disable postcode/zipcode requirement

add_filter('woocommerce_checkout_fields' , 'cc_override_postcode_requirement');

function cc_override_postcode_requirement($fields) {

  $fields['billing']['billing_postcode']['required'] = false;
  $fields['shipping']['shipping_postcode']['required'] = false;
  return $fields;

   View Raw Code ID: 9968