I am using WooCommerce and have the 'Ship to a Different Address' section enabled on the Checkout page. I would like to keep it there, but I am trying to remove a couple fields. More specifically I am trying to remove first name, last name & the state/province fields. I added the following code to my child theme's functions.php file:
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_state']);
unset($fields[‘shipping’][‘shipping_first_name’]);
unset($fields[‘shipping’][‘shipping_last_name’]);
unset($fields[‘shipping’][‘shipping_state’]);
return $fields;
}
The billing fields are eliminated when I use this code, but all shipping fields remain when I open up 'Ship to a different address'. Not exactly sure what I am doing incorrect here, any help would be appreciated. Thanks for your time.