Skip to content

Instantly share code, notes, and snippets.

@max-bulygin
Created March 24, 2017 22:00
Show Gist options
  • Select an option

  • Save max-bulygin/baada95678e53298f22fbf9bee059cd7 to your computer and use it in GitHub Desktop.

Select an option

Save max-bulygin/baada95678e53298f22fbf9bee059cd7 to your computer and use it in GitHub Desktop.
WooCommerce custom fields order
add_filter("woocommerce_checkout_fields", "order_fields");
function order_fields($fields) {
$order = array(
"billing_first_name",
"billing_last_name",
"billing_company",
"billing_address_1",
"billing_address_2",
"billing_postcode",
"billing_country",
"billing_email",
"billing_phone"
);
foreach($order as $field)
{
$ordered_fields[$field] = $fields["billing"][$field];
}
$fields["billing"] = $ordered_fields;
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment