在结帐时移动WooCommerce密码字段

时间:2018-10-13 17:32:12

标签: woocommerce

我正在尝试在CHECKOUT页面上的MOVE旁边输入PASSWORD字段。我进行了搜索,并设法将它们组合在一起,但是它不起作用。

密码字段(重命名为“确认电话号码”)仍然位于结帐的右下角,并且以某种方式(?),电话下方还有一个字段。

enter image description here

这是我正在使用的代码:

add_filter( 'woocommerce_checkout_fields', 'change_order_of_checkout_fields', 15, 1 );
function change_order_of_checkout_fields( $fields ) {

    $billing_order = array(
        'billing_first_name',
        'billing_last_name',
        'billing_email',
        'billing_phone',
        'account_password',
        'billing_company',
        'billing_address_1',
        'billing_address_2',
        'billing_postcode',
        'billing_city',
        'billing_state',
        'billing_country'
    );

    $current_count = 0;
    $priority = 10;

    foreach($billing_order as $field_name){
        $current_count++;
        $fields['billing'][$field_name]['priority'] = $current_count * $priority;
    }

    $fields['billing']['billing_email']['class'] = array('form-row-wide');
    $fields['billing']['billing_phone']['class'] = array('form-row-first');

    $fields['billing']['billing_postcode']['class'] = array('form-row-first');
    $fields['billing']['billing_city']['class'] = array('form-row-last');

    if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) {
        $fields['account']['account_password'] = array(
            'type'          => 'password',
            'label'         => __( 'Confirm Phone Number', 'woocommerce' ),
            'placeholder'   => _x( 'Confirm Phone Number', 'placeholder', 'woocommerce' ),
            'required'      => true,
            'class'         => array('form-row-last')
        );
    }

    return $fields;
}


function woocommerce_password_filter() {
return 0; }
add_filter( 'woocommerce_min_password_strength', 'woocommerce_password_filter', 10 );


add_filter('password_hint', 'change_woocommerce_password_hint_text');
function change_woocommerce_password_hint_text($hint) {
  return "Thank you for conforming your phone number. This will be your password.";
}

关于我要去哪里的任何想法吗?

0 个答案:

没有答案
相关问题