You can test to see if the post is a product with is_product()
and, if it is, remember that custom taxonomies don’t use has_category()
so you have to use has_term( $old_cat, 'product_cat', $post_id )
instead.
You can test to see if the post is a product with is_product()
and, if it is, remember that custom taxonomies don’t use has_category()
so you have to use has_term( $old_cat, 'product_cat', $post_id )
instead.