Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Groups & Staffs › Completely hide restricted categories from vendor's "add product" page
- This topic has 13 replies, 3 voices, and was last updated 6 years, 6 months ago by WCFM Forum.
- AuthorPosts
- May 3, 2018 at 6:57 pm #22731Kristin RuttenGuest
I have restricted the allowed categories by product type for specific vendor groups, but need to know how to make those disallowed categories totally disappear from the category selection list on the page where a vendor adds a new product. For example, I do not want “Uncategorized” to show up at all on the list … only the categories that can be chosen should appear. I also have a few other categories that are for use by site admin only and I don’t want those to appear on the list.
I am using WCFM and all of the premium add-ons along with WC Marketplace.
- May 4, 2018 at 5:23 pm #22755WCFM ForumMember
Hi,
WCfM product manager category select has two views – checklist and select2
In checklist view all categories listed, if not allowed then checkbox not visible.
But in select2 (drop-down) view only allowed categories visible.
You may just take a try the second one, have this option at WCfM Admin Setting -> Dashboard -> Disable Category checklist view
Thank You
- May 4, 2018 at 6:24 pm #22759kristin.ruttenParticipant
Thank you. That works, though I would prefer the checkbox option if it were possible to hide the disallowed categories through a snippet or other method. The dropdown method doesn’t show the hierarchy of main categories & subcategories unless the main categories are allowed for selection, which means I can’t force vendors to choose a subcategory instead of the main category.
- May 5, 2018 at 6:44 pm #22826WCFM ForumMember
Understand. We will change this logic in next update.
Thank You
- May 7, 2018 at 3:19 pm #22934Kristin RuttenGuest
Thanks… the most recent update was helpful because I can now use the checkboxes without having the disallowed categories showing on the list.
The only feature missing that I was hoping for was to be able to prevent selection of the main category if subcategories are available. For example, if I have Main Category A and Subcategories 1, 2 and 3, I would like to prevent the vendor from choosing Main Category A, forcing them to choose one or more of the subcategories instead.
(Also, unrelated but THANK YOU for adding the option of limiting Featured Products!! Very helpful!)
- May 8, 2018 at 2:41 pm #22970WCFM ForumMember
Hi,
This is also possibly to do.
I will provide you some code for this.
Thank You
- May 8, 2018 at 2:50 pm #22971KristinGuest
That would be great… thanks!
- May 8, 2018 at 9:30 pm #23007WCFM ForumMember
Hi,
Here is your custom code for the purpose –
function wcfm_pm_custom_script( $end_point ) { switch( $end_point ) { case 'wcfm-products-manage': ?> <script> jQuery(document).ready(function($) { $('#product_cats_checklist').children('.product_cats_checklist_item').each(function() { $(this).children('label').children('input').addClass('wcfm_custom_hide'); }); }); </script> <?php break; } } add_action( 'after_wcfm_load_views', 'wcfm_pm_custom_script' );
Please know me is this works for you or not!
Thank You
- May 8, 2018 at 9:38 pm #23009KristinGuest
Thanks! That seems to do the trick – the only issue is if there is a main category that has no subcategories because the main category still cannot be selected. (I should be able to work around that if I have to.)
- May 8, 2018 at 9:41 pm #23011WCFM ForumMember
ha ha ha .. first I written code like that to allow non-children main categories and then change to this.
Anyway, use this –function wcfm_pm_custom_script( $end_point ) { switch( $end_point ) { case 'wcfm-products-manage': ?> <script> jQuery(document).ready(function($) { $('#product_cats_checklist').children('.product_cats_checklist_item').each(function() { if( $(this).children('.product_taxonomy_sub_checklist').length > 0 ) { $(this).children('label').children('input').addClass('wcfm_custom_hide'); } }); }); </script> <?php break; } } add_action( 'after_wcfm_load_views', 'wcfm_pm_custom_script' );
Thank You
- May 8, 2018 at 9:44 pm #23012KristinGuest
Perfect!! Thanks so much!
- May 8, 2018 at 9:59 pm #23015WCFM ForumMember
Welcome 🙂
Well, if you ever get a chance then please add a review for me – https://wordpress.org/support/plugin/wc-frontend-manager/reviews/
Thank You
- May 8, 2018 at 10:05 pm #23016KristinGuest
Will do! 🙂
- May 8, 2018 at 10:10 pm #23017WCFM ForumMember
Thanks a lot 🙂
- AuthorPosts
- The topic ‘Completely hide restricted categories from vendor's "add product" page’ is closed to new replies.