Created
January 4, 2023 11:52
-
-
Save FrancoStino/282c321d8e39c1f747183ea46f2dbae5 to your computer and use it in GitHub Desktop.
Force Login Gestionale Woocommerce
This file contains hidden or 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
<?php | |
function woo_login_redirect() { | |
if (! is_user_logged_in() && is_front_page() ) { | |
wp_redirect( wc_get_page_permalink( 'myaccount' ) ); | |
exit; | |
} | |
} | |
add_action('template_redirect', 'woo_login_redirect'); | |
////////////////// | |
add_filter('woocommerce_login_redirect', 'njengah_login_redirect_to_homepage'); | |
function njengah_login_redirect_to_homepage($redirect_to) { | |
return home_url(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment