Redirection after cart validation
-
Hi,
I am processing a cart validation after each item addition with this hook :
add_filter( 'woocommerce_add_to_cart_validation', 'so_validate_add_cart_item', 10, 5 );
so_validate_add_cart_item returns true of false. When it returns false I am redirected to the product detail page :
Please see my code :
if( ! in_array($desired_product_cat , categories_in_cart()) ) { $passed = false; wc_add_notice( __( 'You can not do that', 'textdomain' ), 'error' ); }
But I would like to be redirected to my cart and show the notice in that page. The redirect function doesnt work, what can I do ?
Best Regards
- The topic ‘Redirection after cart validation’ is closed to new replies.