Home » WooCommerce: Move / Reorder Checkout Fields (Email, Country, etc.)

WooCommerce: Move / Reorder Checkout Fields (Email, Country, etc.)

by Tutor Aspire

We’ve already seen how to disable fields on the checkout page by using a simple snippet.

Given my ultimate goal of trying to do as much as possible without installing heavy-weight plugins, today we’ll take a look at how to move fields around inside the billing & shipping sections.

WooCommerce: move billing/shipping checkout fields around
WooCommerce: move billing/shipping checkout fields around

PHP Snippet: Move / Reorder Fields @ WooCommerce Checkout Page

WooCommerce 3.0 has added a “priority” field to each billing and shipping field. Now moving fields @ checkout is much easier!

/**
 * @snippet       Move / ReOrder Fields @ Checkout Page
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    Woo 4.9.2
 * @donate $9     https://www.tutoraspire.com
 */

add_filter( 'woocommerce_default_address_fields', 'tutoraspire_reorder_checkout_fields' );

function tutoraspire_reorder_checkout_fields( $fields ) {

// default priorities:
// 'first_name' - 10
// 'last_name' - 20
// 'company' - 30
// 'country' - 40
// 'address_1' - 50
// 'address_2' - 60
// 'city' - 70
// 'state' - 80
// 'postcode' - 90

  // e.g. move 'company' above 'first_name':
  // just assign priority less than 10
  $fields['company']['priority'] = 8;

  return $fields;
}

PHP Snippet: Move Email Field @ WooCommerce Checkout Page

I’ve written a full article on this feature alone: https://www.businessbloomer.com/woocommerce-move-email-field-to-top-checkout/ – enjoy!

You may also like