Để sắp xếp lại thứ tự hiển thị của các field trong trang checkout bạn cần điều chỉnh lại thuộc tính priority của các field, bạn hãy xem ví dụ đưa email lên đầu trang checkout sau: copy đoạn code dán vào file functions.php

add_filter(  'woocommerce_billing_fields', 'nt_custom_billing_fields', 20, 1 );
function nt_custom_billing_fields( $fields ) {

    ## ---- 1.  Sort billing email---- ##

    $fields['billing_email']['priority'] = 5;
    // $fields['billing_email']['class'] = array('form-row-first');
    // $fields['billing_phone']['priority'] = 40;
    // $fields['billing_phone']['class'] = array('form-row-last');

    return $fields;
}

Kết quả:

move-field-email-to-top

Bài viết liên quan

post-no-image

Cách lấy Page ID một số trang mặc định trong WooCommerce: shop, cart, checkout…

post-no-image

Sắp xếp bài viết theo ID cho sẵn trong WooCommerce

post-no-image

WooCommerce: Tùy chỉnh phần đơn hàng ( $order, $order->get_items()…)

post-no-image

Hướng dẫn tắt tính năng mua hàng nhưng vẫn hiển thị giá trong WooCommerce