Friday, April 19, 2024
WoocommerceWoocommerce HooksWordpressWordpress Hooks

How to reorder checkout fields in WooCommerce 8+?

How to reorder checkout fields in WooCommerce 8+?

Hello guys how are you? Welcome back to my channel. Today in this post I am going to show you How to reorder checkout fields in WooCommerce 8+?

Guys I have used both latest versions WordPress 6.3 and WooCommerce 8.6.

Live Demo

Guys if you are new in WordPress or in WooCommerce then please check the below links for some good tutorials:

  1. WooCommerce Hooks
  2. WordPress Tricks
  3. WordPress Hooks

Guys here is the working code snippet and please use it carefully:

1. Guys here is the code snippet need to add your theme’s functions.php file:

add_filter( 'woocommerce_checkout_fields', 'therichpost_reorder_checkout_fields' );
function therichpost_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 'email','phone' up:
  // just assign priority
     $fields['billing']['billing_email']['priority'] = 20;
     $fields['billing']['billing_phone']['priority'] = 25;
    return $fields;

This is it guys and if you will have any kind of query, suggestion or requirement then feel free to comment below.


Developer’s King


the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.