• Resolved Picflick

    (@picflick)


    Hi,

    Can you please explain how I can prevent my vendors from assigning products to certain categories when they upload products for sale. If you can see the attached image (Link) I want to prevent them from selecting the highlighted categories but allow them to be able to select the others.

    Thanks,
    PicFlick

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @picflick, thanks for reaching WCMp Support!!

    Currently, our plugin lets the vendor use all the categories of the site. Now, you can do custom code and restrict some categories to be accessed by vendors.

    Alternatively, you may use our addon WCMp Vendor Membership plugin (https://wc-marketplace.com/product/wcmp-vendor-membership/) and create a plan. Now, under each plan you can select the categories, that the vendor ca access (see this scrrenshot – https://prnt.sc/orh6wg).

    let us know if you have any further query.

    Thread Starter Picflick

    (@picflick)

    Hi,

    Thank you very much for the prompt response! ??

    Whilst we would like to use your extension, it is not financially viable for the current set up of our business. Therefore, I would appreciate if you can please assist us with inputting the custom code – It doesnt need to be complicated, all we are trying to do is prevent 2 categories from showing on the ‘Add product’ page. So if you can just help us hide those 2 please.

    Many thanks!
    PicFlick

    • This reply was modified 5 years, 3 months ago by Picflick.

    Add follows code snippet in your active theme’s functions.php and make sure to replace term ids with your own –

    function wcmp_filter_product_cat_query_args( $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( 12, 15 ); // 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', 99 );
    Thread Starter Picflick

    (@picflick)

    Thanks so much Khokan, this looks great!

    Please can you explain how I can identify/locate on the back-end what the corresponding term_id is for the front-end name.

    Regards,
    PicFlick

    @picflick Go to WP Dashboard -> Products -> Categories and then find the category that you want the term id for, just edit the category. You will get the corresponding term id for the category from the admin page URL with mentioned as tag_ID.

    Thread Starter Picflick

    (@picflick)

    Thank you – worked just fine
    Appreciate the help ??

    You are welcome @picflick

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Prevent vendors’ is closed to new replies.