Customizing checkout fields using actions and filters (ok)

https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

  add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields');
  function custom_override_checkout_fields($fields)
  {
    $fields['billing']['billing_first_name'] = [
      'class' => ['form-row-wide'],
    ];
    unset($fields['billing']['billing_last_name']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_city']);
    unset($fields['billing']['billing_country']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_postcode']);
    $fields['billing']['billing_email'] = [
      'required' => false,
      'class'    => ['form-row-wide'],
    ];
    return $fields;
  }

Last updated