Custom Redirect function broken in 2.1.x
-
This redirect function was working just fine in WooCommerce version 2.0.x –
// ADD ACTION FOR CHECKING PRODUCTS WHICH HAVE BEEN ADDED TO THE CART add_action( 'template_redirect', 'check_cart_product', 0 ); function check_cart_product(){ // GET THE PRODUCT ID $product_ID = $_GET['added-to-cart']; // GET THE CATEGORY ID $term_list = wp_get_post_terms($product_ID,'product_cat',array('fields'=>'ids')); $cat_id = (int)$term_list[0]; // COMPARE THE CATEGORY ID AND THEN REDIRECT TO OTHER PRODUCT if($cat_id == 25) wp_redirect(get_permalink(352)); }
After upgrading to 2.1.x, this function no longer works. Anyone have any ideas why or how to fix it?
- The topic ‘Custom Redirect function broken in 2.1.x’ is closed to new replies.