Restrict product categories from being selected

MultivendorX

Resolved
Viewing 3 reply threads
  • Author
    Posts
    • #197200
      Picflick
      Participant

      Hi,
      You previously provided this code that would remove certain ‘product categories’ from being selected:

      function wcmp_filter_product_cat_query_args_callback( $args ) {
       if ( !isset( $args['taxonomy'] ) && $args['taxonomy'] != 'product_cat' ) return $args;
       // add your term_ids within follows array that you want to exclude from vendor product categories list
       $args['exclude'] = array( 35905, 37037, 36883,39003,39004); // lets assume 12 & 15 term_id want to exclude from vendor
       return $args;
      }
      add_filter( 'wcmp_get_product_terms_product_cat_query_args', 'wcmp_filter_product_cat_query_args_callback', 99 );
      Copy

      It no longer works. Please can you provide updated code.
      For clarity, I want to prevent the above product categories from showing on the ‘add product’ page for vendors (see https://ibb.co/2tPMxCY)
      Thanks

    • #197256

      Kindly add the below code in the functions.php file of your current active theme and check –

      
      add_filter( 'mvx_vendor_product_classify_first_level_categories', 'mvx_vendor_product_cat_remove');
      function mvx_vendor_product_cat_remove($cat_array) {
          $cat_array['exclude'] = array(15); // add category id here saparated by comma
          return $cat_array;
      }
      
      Copy
    • #197334
      Picflick
      Participant

      Thank you it worked 🙂
      We can close this ticket

    • #197338

      Happy to hear that.
      It would be really great if you can give us 5/5 review here: https://wordpress.org/support/plugin/dc-woocommerce-multi-vendor/reviews/#new-post
      This would motivate the team further to do their job more efficiently.

Viewing 3 reply threads

The topic ‘Restrict product categories from being selected’ is closed to new replies.