2012-10-03 262 views
1

我正在使用WordPress woocommerce plugin作出eCommerce site。一切都很好,約woocommerce plugin。但是,當我看到register部分,其中用戶將製造register all of his details,沒有custom fieldsgender, phone no, address etc。我需要所有這些東西在register page。那麼該怎麼做?任何幫助建議都將非常可觀。需要wordpress woocommerce插件的自定義輸入字段

回答

-1

您將不得不編輯插件文件才能擁有此功能。可能需要改變

  • 模板/形式checkout.php文件
  • 類/不會被要求作爲條目類-WC-checkout.php

數據庫的變化將被保存在wp_usermeta表。

在情況下,如果你是通過WordPress的的註冊頁面註冊的用戶,然後用像Cimy User Extra Fields

+0

編輯插件文件將阻止用戶將來進行更新,或者更新將覆蓋其更改 –

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'); 

您可以修改字段爲文本框,單選按鈕或任何超出您的需要的字段。

希望它有幫助:)

Manu。