• Skip to main content
  • Skip to primary sidebar

WordPress, Genesis Framework and Storefront customization tutorials

  • Archive
    • Free
    • Premium
  • Blog
  • About
  • Contact
  • Newsletter
  • Login
Home » Free » Page 19

Free

Redirect after registration


//Redirect after registration
add_filter( 'woocommerce_registration_redirect', 'custom_redirection_after_registration', 10, 1 );
function custom_redirection_after_registration( $redirection_url ){
if ( WC()->cart->get_cart_contents_count() == 0 ) {
$redirection_url = get_permalink( wc_get_page_id( 'shop' ) );

}else{

// Change the redirection Url
$redirection_url = wc_get_checkout_url(); //Checkout
}

return $redirection_url; // Always return something
}

/*
"Home" Url: $redirection_url = get_home_url();
"Shop" Url: $redirection_url = get_permalink( wc_get_page_id( 'shop' ) );
"Cart" Url: $redirection_url = wc_get_cart_url();
"Checkout" Url: $redirection_url = wc_get_checkout_url();
"Account" $redirection_url = get_permalink( wc_get_page_id( 'myaccount' ) );
"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/');
*/

Filed Under: Free Tagged With: WooCommerce

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 17
  • Page 18
  • Page 19

Primary Sidebar

Gabor Flamich

Hi! I'm Gabor.
I write tutorials on WordPress and WooCommerce.

MacBook

12 Essential Snippets for Genesis Developers

Subscribe to my Newsletter to view my basic collection of Genesis snippets that I use for my projects!

Sign Up for Free
  • Facebook
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube
UpdraftPlus Premium

Tags

ACF Ajax Analytics API Bootstrap Breadcrumb category CPT CSS fetch FSE Genesis Google Maps Gutenberg HTML Isotope JavaScript jQuery loop Map Menu Parallax PHP Rest API SASS SEO SQL Storefront SVG tab tag manager tags Taxonomy Tool upsell Webpack Wholesale WooCommerce WordPress WPML

Disclosure: Some of the links in this site are affiliate links. I will be paid a commission if you use this link to make a purchase.

  • Privacy Policy / Terms of Service
© 2025 WP Flames - All Right Reserved