• Hello,
    I’ve been struggling to change order of field in shipping address in Account page.
    I could change the order of field in checkout field with this snippet,

    ——————-
    // Change Order
    add_filter(“woocommerce_checkout_fields”, “order_fields”);

    function order_fields($fields) {

    $order = array(

    “shipping_country”,
    “shipping_state”,
    “shipping_postcode”,
    “shipping_address_1”,
    “shipping_address_2”,
    “shipping_first_name”,
    “shipping_phone”,
    “shipping_delivery_place”,
    “shipping_date”,
    “shipping_time”

    );
    foreach($order as $field)
    {
    $ordered_fields[$field] = $fields[“shipping”][$field];
    }

    $fields[“shipping”] = $ordered_fields;
    return $fields;

    }
    ———————-

    But in the edit shipping address page, it shows with default order (Same as order of billing address).

    Please tell me how to change the order of field of only shipping address in Account page?

    https://www.ads-software.com/plugins/woocommerce/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Claudio Sanches

    (@claudiosanches)

    Not sure what are you doing, since this foreach only assigns the field to a new array and returns their value back. I don’t see any code trying to change the order… That’s why still shows the default order.

    Thread Starter halehaleomiyage

    (@halehaleomiyage)

    Thank you for your reply.
    I thought this code is for changing the order…
    So could you tell me how to change the order?

    Plugin Contributor Claudio Sanches

    (@claudiosanches)

    @halehaleomiyage You can rewrite this array as you wish. or use PHP functions to work with arrays.

    Hi,

    I am struggling to find the right way of changing the fields order. Managed to do this for checkout fields, but I’m now having trouble with the My Account billing/shipping address forms. Could you please help?

    Thanks
    Kate

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to change order of field in "edit shipping address"’ is closed to new replies.