Reordering checkout fields in WooCommerce 3

后端 未结 3 1599
一生所求
一生所求 2020-11-29 13:04

I\'m trying to re-order 2 custom checkout fields added with the help of woocommerce_checkout_init filter, just that when I apply woocommerce_checkout_fiel

3条回答
  •  一生所求
    2020-11-29 13:18

    To Add to the accepted answer...

    If you need to move form fields from one field group to another, for example moving a shipping field into billing or an account field into billing, you can do the following.

    function move_password_field($checkout_fields){
        // Move Account Password into Billing
        $checkout_fields['billing']['account_password'] = $checkout_fields['account']['account_password']; 
    
        // Remove Password from Billing
        unset($checkout_fields['account']['account_password']);
    
        return $checkout_fields;
    }
    
    add_filter('woocommerce_checkout_fields', 'move_password_field', 999);
    

提交回复
热议问题