在woocommerce我的帐户页面中添加银行详细信息选项卡和输入字段

时间:2018-07-08 10:50:46

标签: php wordpress woocommerce hook-woocommerce

我正在尝试从标签银行详细信息中添加用户的银行详细信息,我需要帮助,我无法提交表单,并且希望将此数据保存并显示在show_user_profile This is where i add

add_filter( 'woocommerce_account_menu_items', 'bbloomer_remove_address_my_account', 999 );
 
function bbloomer_remove_address_my_account( $items ) {
unset($items['downloads']);
return $items;
}
function iconic_account_menu_items( $items ) {
unset($items['customer-logout']);
    $items['information'] = __( 'Bank Details', 'iconic' );
    $items['customer-logout'] = __( 'Logout');

    return $items;

}

add_filter( 'woocommerce_account_menu_items', 'iconic_account_menu_items', 10, 1 );
function iconic_add_my_account_endpoint() {
 
    add_rewrite_endpoint( 'information', EP_PAGES );
 
}
 

add_action( 'init', 'iconic_add_my_account_endpoint' );
function iconic_get_account_fields() {
   echo "Please enter bank details";
$user_id = get_current_user_id(); ?>

<form  action="" method="post">
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
		<label for="acc_number"><?php esc_html_e( 'Account Number', 'woocommerce' ); ?>&nbsp;<span class="required">*</span></label>
		<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="acc_number" id="acc_number" value="<?php echo esc_attr( $user->acc_number); ?>" />
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
		<label for="acc_name"><?php esc_html_e( 'Account Name', 'woocommerce' ); ?>&nbsp;<span class="required">*</span></label>
		<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="acc_name" id="acc_name" value="<?php echo esc_attr( $user->acc_name); ?>" />
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
		<label for="acc_ifsc"><?php esc_html_e( 'Bank IFSC', 'woocommerce' ); ?>&nbsp;<span class="required">*</span></label>
		<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="acc_ifsc" id="acc_ifsc" value="<?php echo esc_attr( $user->acc_ifsc); ?>" />
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
		<label for="acc_type"><?php esc_html_e( 'Type of Account', 'woocommerce' ); ?>&nbsp;<span class="required">*</span></label>
		<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="acc_type" id="acc_type" value="<?php echo esc_attr( $user->acc_type); ?>" />

<p>
		
		<button type="submit" class="woocommerce-Button button" name="save_bankdetails" value="save_bankdetails">Submit Details</button>
		<input type="hidden" name="save_bankdetails" value="save_bankdetails" />
	</p>

</form>



 <?php }

add_action( 'woocommerce_account_information_endpoint', 'iconic_get_account_fields' );
function iconic_is_endpoint( $endpoint = false ) {
 
    global $wp_query;
 
    if( !$wp_query )
        return false;
 
    return isset( $wp_query->query[ $endpoint ] );
 
}
好像有什么问题是错的,请让我知道我是新来的。

您的帮助将不胜感激

0 个答案:

没有答案