Make required false in woocommerce state field wordpress
add_filter( ‘woocommerce_billing_fields’, ‘wc_cf_filter_state’, 10, 1 ); function wc_cf_filter_state( $fields ) { $fields [‘billing_state’][‘required’] = false; return $fields ; }
add_filter( ‘woocommerce_billing_fields’, ‘wc_cf_filter_state’, 10, 1 ); function wc_cf_filter_state( $fields ) { $fields [‘billing_state’][‘required’] = false; return $fields ; }
/** Remove all possible fields **/ function wc_remove_checkout_fields( $fields ) { // Billing fields unset( $fields[‘billing’][‘billing_company’] ); unset( $fields[‘billing’][‘billing_email’] ); unset( $fields[‘billing’][‘billing_phone’] ); unset( $fields[‘billing’][‘billing_state’] ); unset( $fields[‘billing’][‘billing_first_name’] ); unset( $fields[‘billing’][‘billing_last_name’] ); unset( $fields[‘billing’][‘billing_address_1’] ); unset( $fields[‘billing’][‘billing_address_2’] ); unset( $fields[‘billing’][‘billing_city’] ); unset( $fields[‘billing’][‘billing_postcode’] ); // Shipping fields unset( $fields[‘shipping’][‘shipping_company’] ); unset( $fields[‘shipping’][‘shipping_phone’] ); unset( $fields[‘shipping’][‘shipping_state’] …
Remove field from checkout page in woocommerce wordpress Read More »