Woo-commerce注册表单添加otp作为自定义字段

时间:2018-06-05 05:40:35

标签: php wordpress woocommerce hook-woocommerce

我想在用户注册woo-commerce注册页面时添加otp,我已经为电话号码添加了自定义字段但是我无法获得任何otp的来源 - 如果有人可以,我有自己的API分享任何资源 寻找它

这将非常有帮助......



function iconic_get_account_fields() {
    return apply_filters( 'iconic_account_fields', array(
        'user_url' => array(
            'type'        => 'text',
            'label'       => __( 'Phone' ),
            'placeholder' => __( 'E.g. 9861234567', 'iconic' ),
            'required'    => true,
        ),
    ) );
}
function iconic_print_user_frontend_fields() {
    $fields = iconic_get_account_fields();
 
    foreach ( $fields as $key => $field_args ) {
        woocommerce_form_field( $key, $field_args );
    }
}
 
add_action( 'woocommerce_register_form', 'iconic_print_user_frontend_fields', 1 );

add_action( 'woocommerce_edit_account_form', 'iconic_print_user_frontend_fields', 10 ); // my account

function iconic_print_user_admin_fields() {
    $fields = iconic_get_account_fields();
    ?>
    <h2><?php _e( 'Additional Information', 'iconic' ); ?></h2>
    <table class="form-table" id="iconic-additional-information">
        <tbody>
        <?php foreach ( $fields as $key => $field_args ) { ?>
            <tr>
                <th>
                    <label for="<?php echo $key; ?>"><?php echo $field_args['label']; ?></label>
                </th>
                <td>
                    <?php $field_args['label'] = false; ?>
                    <?php woocommerce_form_field( $key, $field_args ); ?>
                </td>
            </tr>
        <?php } ?>
        </tbody>
    </table>
    <?php
}
 
add_action( 'show_user_profile', 'iconic_print_user_admin_fields', 30 ); // admin: edit profile
add_action( 'edit_user_profile', 'iconic_print_user_admin_fields', 30 );
&#13;
&#13;
&#13;

0 个答案:

没有答案