Reordering WooCommerce checkout fields

I’m a hungarian developer. In our language the first name doesn’t come first. One of my client requested to reorder the name fields on the checkout page. Here is my snippet to do that:

As you see it I did two things:

  1. Swapped firstname’s and lastname’s priority. Trough this propery you can controll the ordering of the checkout field. The field with the lowest priority comes first.
  2. I swapped the classes of these fields. Firsname and lastname are rendered as columns in the same row. So we have to swap classes too not just priority.

In the woocommerce_checkout_fields action you can access all checkout fields. You can reorder as you wish.

Close Menu