Chuyển hướng người dùng sau khi đăng ký (Redirect Users After WooCommerce Registration)

Nếu bạn muốn chuyển hướng người dùng sau khi đăng ký, bạn có thể sử dụng đọan code PHP sau đây:

Redirect after Registration

Đoạn code chuyển hướng sau khi đăng ký. Mình có ghi chú cách tùy biến url bạn muốn chuyển hướng ở phía dưới. Bạn có thể tham khảo.

add_filter( 'woocommerce_registration_redirect', 'custom_redirection_after_registration', 10, 1 );
function custom_redirection_after_registration( $redirection_url ){
    // Change the redirection Url
    $redirection_url = wc_get_cart_url(); // Cart page

    return $redirection_url; // Always return something
}


 //   Get the "Home" page Url: $redirection_url = get_home_url();
 //   Get the "Shop" page url: $redirection_url = get_permalink( wc_get_page_id( 'shop' ) );
 //   Get the "Cart" page Url: $redirection_url = wc_get_cart_url();
 //   Get the "Checkout" page Url: $redirection_url = wc_get_checkout_url();
 //   Get the "My account" or registration page Url:
 //   $redirection_url = get_permalink( wc_get_page_id( 'myaccount' ) );
 //   Get other post or pages by ID: $redirection_url = get_permalink( $post_id );
 //   (where $post_id is the id of the post or the page)
 //   Get post or pages by path (example): $redirection_url = home_url('/product/ninja/');

Chúc các bạn thực hiện chuyển hướng người dùng sau khi đăng ký thành công.

0989 333 069
Chat Zalo