2017-01-11 1054 views
1

我有一個在線學校網站,其中包含一個現有註冊頁面,我需要使用它從用戶獲取特定數據(請參閱此處:http://www.inventivewebdesign.com/nvtss/register/)。更改WooCommerce註冊頁面

問題是要購買用戶通過WooCommerce發送的課程。作爲這一過程的一部分,將提示用戶在這裏使用WooCommerce的註冊頁面進行註冊:http://www.inventivewebdesign.com/nvtss/checkout/(您可能需要的東西添加到您的購物車,看看它:您可以add this

的問題似乎是,該證書我們打印必須有來自第一個註冊頁面的數據。

有沒有辦法迫使WooCommerce從那裏使用註冊表單或者只是先到那個頁面?

我正在使用Gravity Forms Pro將這些項目添加到第一頁上的用戶註冊。

回答

0

是的這是完全可以使用自定義掛鉤功能。

當一個未登錄的顧客將在結帳頁面到達(剛購物車處理後),他將被重定向到您的特定註冊頁面。

這裏是代碼:

add_action('woocommerce_before_checkout_form', 'redirect_customer_login_access'); 
function redirect_customer_login_access() { 

    // Here the conditions (woocommerce my account pages and unlogged user) 
    if(is_checkout() && !is_user_logged_in()){ 

     // Define HERE your custom login form 
     $custom_login_url = site_url('/nvtss/register/'); 
     // if nvtss is the root of your wordpress web site, the url is going to be: 
     // $custom_login_url = site_url('/register/'); 

     // Redirecting to your custom login area 
     wp_redirect($custom_login_url); 

     // always use exit after wp_redirect() function. 
     exit; 
    } 
} 

代碼放在您的活動子主題的function.php文件(活動的主題或任何插件文件)。

該代碼已經過測試並且可以正常工作。