WooCommerce login redirect based on cart
case 1: function wpse_131562_redirect() { if ( ! is_user_logged_in() && (is_cart() || is_checkout()) ) { // feel free to customize the following line to suit your needs wp_redirect( home_url( ‘/my-account/’ ) ); exit; } } add_action(‘template_redirect’, ‘wpse_131562_redirect’);