1

WordPress woocommerce plugin用来制作eCommerce site. 一切都很好woocommerce plugin。但是当我看到register用户会制作的部分时register all of his details,没有custom fields喜欢gender, phone no, address etc。我需要所有这些东西在register page. 那么该怎么做呢?任何帮助和建议都将是非常可观的。

4

3 回答 3

3

这个插件就是你要找的http://wordpress.org/extend/plugins/cimy-user-extra-fields/。您将能够在注册表单中添加额外的字段,并将其添加到用户的用户个人资料页面中。

这是示例注册表的屏幕截图http://wordpress.org/extend/plugins/cimy-user-extra-fields/screenshots/

我个人在这里使用这个http://mayumibeats.com/wp-signup.php?blog_id=1

干杯!

于 2012-10-13T07:24:54.787 回答
0

您可以添加自己的字段,将以下代码添加到您的 wordpress 主题 functions.php 文件中。

/**
 * Add new register fields for WooCommerce registration.
 *
 * @return string Register fields HTML.
 */
function wooc_extra_register_fields() {
    ?>

    <p class="form-row form-row-first">
    <label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?> <span class="required">*</span></label>
    <input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" />
    </p>

    <p class="form-row form-row-last">
    <label for="reg_billing_last_name"><?php _e( 'Last name', 'woocommerce' ); ?> <span class="required">*</span></label>
    <input type="text" class="input-text" name="billing_last_name" id="reg_billing_last_name" value="<?php if ( ! empty( $_POST['billing_last_name'] ) ) esc_attr_e( $_POST['billing_last_name'] ); ?>" />
    </p>

    <div class="clear"></div>

    <p class="form-row form-row-wide">
    <label for="reg_billing_phone"><?php _e( 'Phone', 'woocommerce' ); ?> <span class="required">*</span></label>
    <input type="text" class="input-text" name="billing_phone" id="reg_billing_phone" value="<?php if ( ! empty( $_POST['billing_phone'] ) ) esc_attr_e( $_POST['billing_phone'] ); ?>" />
    </p>

    <?php
}

add_action( 'woocommerce_register_form_start', 'wooc_extra_register_fields' );

您可以将字段修改为文本框、单选按钮或您需要的任何内容。

希望能帮助到你 :)

马努。

于 2015-11-04T15:02:28.500 回答
-1

您必须编辑插件文件才能拥有此功能。可能需要更改的文件是

  • 模板/form-checkout.php
  • 类/类-wc-checkout.php

不需要更改数据库,因为条目将保存在 wp_usermeta 表中。

如果您通过 Wordpress 的注册页面注册用户,请使用Cimy User Extra Fields 之类的插件

于 2012-10-11T10:50:11.340 回答