Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

wp wc php if cart page is empty redirect

add_action("template_redirect", 'redirection_function');
function redirection_function(){
    global $woocommerce;
    if( is_cart() && WC()->cart->cart_contents_count == 0){
        wp_safe_redirect( get_permalink( woocommerce_get_page_id( 'shop' ) ) );
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #wp #wc #php #cart #page #empty #redirect
ADD COMMENT
Topic
Name
9+4 =