How to make a custom redirect in WooCommerce?
add_action(‘template_redirect’, ‘woo_custom_redirect’); function woo_custom_redirect($redirect) { // HERE set your product category (can be term IDs, slugs or names) $category = ‘subscription’; $found = false; // CHECK CART ITEMS: search for items from our product category foreach(WC() – > cart – > get_cart() as $cart_item) { if (has_term($category, ‘product_cat’, $cart_item[‘product_id’])) { $found = true; break; } … Read more