Woocommerce redirect issue after login all shop and catalog page redirect on my account page

<?php
if ( !is_user_logged_in() ) {
 if(is_woocommerce() || is_shop() || is_cart() || is_checkout())  {

      wp_redirect( get_permalink( get_option('woocommerce_myaccount_page_id')) );
     exit();
 }
}

?>

Without user login visit any woocommerce page i need to redirect woocommerce my account page but after user login in myaccount page when i try to visit that same woocommerce page its redirect me to myaccount page. but when visit any other woocommerce page its working perfect.
I have used above code for redirection but i think it store in catche or something redirection issue so user visit same url that redirects to myaccount if user login also.

Read more here: Woocommerce redirect issue after login all shop and catalog page redirect on my account page

Leave a Reply

Your email address will not be published. Required fields are marked *