Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › Prevent products in a specific category from being shown in vendor\'s dashboard
Tagged: products
- This topic has 2 replies, 2 voices, and was last updated 4 years, 6 months ago by mishareed.
- AuthorPosts
- May 19, 2020 at 7:19 pm #133144mishareedParticipant
Hi – I have a product for gratuity that I add to each of my vendor’s product catalogs. To allow billing and refunds to work properly, I need the product to be listed in the vendor’s store, but I don’t want them to be able to view or modify the product. Is there a way to prevent products from a specific category from being show in the vendor’s product list?
Thanks!
- May 20, 2020 at 1:57 pm #133467Sarmistha ChakrabortyMember
Hello,
You can set product capability for vendor, only turn on “manage products” from capability, then the vendor can not modify the products.(PFA)
Is there a way to prevent products from a specific category from being show in the vendor’s product list?
>>What we understand that you want some products(with specific category) will not display in vendor’s dashboard product manager but will display in vendor’s store page.
For this, It’s not feasible to hide those products, but it’s possible to prevent edit/modify those products.
Try the below code in your theme’s functions.phpadd_filter( 'wcfm_is_allow_edit_specific_products', 'wcfm_is_allow_edit_specific_products_2005', 10,2 ); function wcfm_is_allow_edit_specific_products_2005( $bool, $product_id ) { $term_list = wp_get_post_terms($product_id, 'product_cat', array('fields' => 'ids')); if (in_array(15, $term_list)){ //replace 15 with your specific product category id $bool = false; } return $bool; }
Thanks.
Attachments:
You must be logged in to view attached files. - May 20, 2020 at 8:25 pm #133575mishareedParticipant
Thanks! The function worked to prevent most editing. The products can still be edited using the bulk update functionality, but I was able to work around that. Thanks again for your help.
- AuthorPosts
- You must be logged in to reply to this topic.