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.

Revisions

  1. max-bulygin created this gist Mar 24, 2017.
    25 changes: 25 additions & 0 deletions woo_fields_order.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    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;

    }