• Resolved tigo

    (@tigo)


    I need the address fields to be displayed in the following order on the checkout page: state, city, address_1, address_2.
    I try to set the priorities. The fields get rendered in the desired order in HTML. However they are reordered back to address_1, address_2, city, state from some JavaScript.
    How can I set the order properly and avoid sorting from JS?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @tigo. You would probably want to use the Checkout Field Editor plugin for this. If you wanted to code it yourself, you would need to change the checkout page template. You can read more about editing templates here.

    Customizations like this are outside the scope of our support, so I’m not entirely sure how the fields on the checkout page are organized, but it’s possible that the rearranging is happening through CSS and not JS. Something like CSS Grid would allow the page to arrange the fields in a set pattern regardless of what order they appeared in in the HTML, so that would also be something to look at.

    Thread Starter tigo

    (@tigo)

    Hi, @apmwebdev it doesn’t seem like you understood my question. Let me clarify.
    I am trying to modify fields using “woocommerce_checkout_fields” filter hook in the “functions.php” file in my theme, and assigning them priorities. The order in the produced HTML is correct, however the fields get reordered later with JavaScript. I know it is JavaScript and not CSS since the order is actually changed when inspected through Dev Tools elements panel. Also when I disable JavaScript, the fields retain their correct order.

    Plugin Support Senff

    (@senff)

    Hi @tigo

    If the HTML source shows the fields in the correct order, but on the site they don’t, another plugin may be causing this.

    Can you share a link to your site so we can check this a bit more?

    Thread Starter tigo

    (@tigo)

    @senff I have the same problem on my local clean WordPress installation with WooCommerce being the only active plugin, and Twenty Twenty theme (child theme to be precise).
    Also, can’t change label or placeholder text. Gets changed in HTML source, but reassigned to the values from the language file later (from JS).

    WordPress 5.4.2
    WooCommerce 4.2.0

    If you can’t replicate the issue, I can create a clean WordPress installation on the server for you and provide admin credentials. Please let me know.

    Hi @tigo,

    Back end credentials are not recommended to place here in an open forum, but if you have the link to the site handy we can take a look and see what might be happening with the JavaScript.

    Can you post either the System Status Report, or at least the URL of the site in question so we can take a closer look? I look forward to hearing back from you!

    dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hi @tigo

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Thanks,

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Can’t reorder address fields’ is closed to new replies.