Answers for "woocommerce remove billing and shipping fields"

0

woocommerce remove billing and shipping fields

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
add_filter( 'woocommerce_billing_fields' , 'custom_override_billing_fields' );
add_filter( 'woocommerce_shipping_fields' , 'custom_override_shipping_fields' );

// Insert here billing and shipping fiels
function custom_override_checkout_fields( $fields ) {
	unset($fields['billing']['billing_state']);
	unset($fields['billing']['billing_address_2']);
    ...
    
	unset($fields['shipping']['shipping_state']);
	unset($fields['shipping']['shipping_address_2']);	
    ...
    
	return $fields;
}

// Insert here only billing fiels
function custom_override_billing_fields( $fields ) {
	unset($fields['billing_state']);
	unset($fields['billing_address_2']);
    ...
    
	return $fields;
}

// Insert here only shipping fiels
function custom_override_shipping_fields( $fields ) {
	unset($fields['shipping_state']);
	unset($fields['shipping_address_2']);
	unset($fields['shipping_company']);
    ...
    
	return $fields;
}
Posted by: Guest on July-14-2021

Code answers related to "woocommerce remove billing and shipping fields"

Browse Popular Code Answers by Language