Skip to content

Instantly share code, notes, and snippets.

@rwkyyy
Created August 2, 2018 14:57
Show Gist options
  • Save rwkyyy/0a7e6a3fd39a5ad640f190164d699e91 to your computer and use it in GitHub Desktop.
Save rwkyyy/0a7e6a3fd39a5ad640f190164d699e91 to your computer and use it in GitHub Desktop.
Redirect WooCommerce for non-logged-in
function rwk_redirect_b2b() {
if (
! is_user_logged_in()
&& (is_woocommerce() || is_cart() || is_checkout())
) {
// feel free to customize the following line
wp_redirect( site_url('autentificare/') )
exit;
}
}
add_action('template_redirect', 'rwk_redirect_b2b');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment