Created
August 2, 2018 14:57
-
-
Save rwkyyy/0a7e6a3fd39a5ad640f190164d699e91 to your computer and use it in GitHub Desktop.
Redirect WooCommerce for non-logged-in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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