Redirect in shop page if cart empty
-
Hi
i skip the cart page. when i delete the last item, the plugin return to cart page and create an ilimate loop ??
i use your code in my theme function but not work:
function skip_cart_page_redirection_to_checkout() {
// If is cart page, redirect checkout.
if( is_cart() && WC()->cart->cart_contents_count != 0 ) {
wp_redirect( WC()->cart->get_checkout_url() );
}else if ( is_cart() && WC()->cart->cart_contents_count == 0 ) {
wp_safe_redirect( get_permalink( woocommerce_get_page_id( ‘shop’ ) ) );
}
}Can you give me the right code to fix this problem?
many thanks
- The topic ‘Redirect in shop page if cart empty’ is closed to new replies.