SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 125 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function woo_discount_rules_accepted_taxonomy_for_category_method($taxonomy){
  2.     $taxonomy[] = 'product_type';
  3.     return $taxonomy;
  4. }
  5.  
  6. add_filter('woo_discount_rules_accepted_taxonomy_for_category', 'woo_discount_rules_accepted_taxonomy_for_category_method', 10);
  7.  
  8. function woo_discount_rules_load_additional_taxonomy_method($categories, $product_id){
  9.    $taxonomy_to_apply = 'product_type';
  10.     $tags = get_the_terms( $product_id, $taxonomy_to_apply );
  11.     if(isset($tags) && (is_object($tags) || is_array($tags)) && count($tags) > 0) {
  12.         foreach ($tags as $tag){
  13.             $categories[] = $tag->term_id;
  14.         }
  15.     }
  16.  
  17.     return $categories;
  18. }
  19. add_filter('woo_discount_rules_load_additional_taxonomy', 'woo_discount_rules_load_additional_taxonomy_method', 10, 2);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top