Vendor can select only the lowest sublevel category for new product.

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Ultimate Vendor can select only the lowest sublevel category for new product.

Viewing 3 reply threads
  • Author
    Posts
    • #107167
      marcinzywy
      Participant

      Hi WC Lovers,

      I would like vendors to be able to choose only the lowest subcateogry when adding new product.

      For example, I have categories such as:

      * Main category
      – Subcategory 1
      – Subcategory 2
      –> Subcategory 2A
      –> Subcategory 2B
      – Subcategory 3

      Therefore, vendor should not be able to choose Main Category, or Subcategory 2, because these categories have their subcategories. So the system should not allow to publish/add this product, as the lowest subcategory is not selected. Also, when vendor selects Subcategory 2A, the product should be added only to Subcategory 2A (not to Main Category, Subcategory 2).

      Please let me know if this is possible to achieve or not.

    • #107802
      WCFM Forum
      Keymaster

      HI,

      Please add this code to your site for the purpose –

      add_action( 'after_wcfm_products_manage', function() {
      	?>
      	<script>
      	jQuery(document).ready(function($) {
      		setTimeout(function() {
      			$('#product_cats_checklist').children('.product_cats_checklist_item').each(function() {
      				if( $(this).children('.product_taxonomy_sub_checklist').length > 0 ) {
      					$(this).children('.checklist_type_product_cat').addClass('wcfm_custom_hide');
      				}
      			});
      		}, 1000);
      	});
      	</script>
      	<?php 
      }, 50 );

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin –¬†https://wordpress.org/plugins/code-snippets/

      Thank You

    • #107822
      marcinzywy
      Participant

      Thank you for the code, however this code doesn’t work.

      My vendor can still publish product using main category, any sub level category.

      Is there anything I should change in this code to be ‘applicable’ for my website?

      Thank you for your help.

    • #108648
      WCFM Forum
      Keymaster
Viewing 3 reply threads
  • You must be logged in to reply to this topic.