Category limit not working

This topic contains 2 replies, has 2 voices, and was last updated by  dale 1 week, 5 days ago.

  • Author
    Posts
  • #23251

    dale
    Participant

    Under Groups I have a Basic group which has the category limit set to 3. Under Categories I have selected 3 categories. However, the seller who is part of this group seems to be able to post products in additional categories. See attached screenshot.

    Attachments:
    You must be logged in to view attached files.
  • #23272
    WCfM Forum
    WCfM Forum
    Keymaster

    Hi,

    Are you using only WCfM – Groups & Staffs or also have WCfM Ultimate?

    If you don’t have WCfM Ultimate then add this function to your site –

    function wcfmcap_allowed_taxonomies_custom( $allow, $taxonomy, $term_id ) {
    	$wcfm_capability_options = apply_filters( 'wcfm_capability_options_rules', get_option( 'wcfm_capability_options', array() ) );
    	if( $taxonomy == 'product_cat' ) $taxonomy = 'categories';
    	$allowed_taxonomies    = ( !empty( $wcfm_capability_options['allowed_' . $taxonomy] ) ) ? $wcfm_capability_options['allowed_' . $taxonomy] : array();
    	if( is_array( $allowed_taxonomies ) && !empty( $allowed_taxonomies ) ) {
    		if( !in_array( $term_id, $allowed_taxonomies ) ) {
    			$allow = false;
    		}
    	}
    	return $allow;
    }
    add_filter( 'wcfm_allowed_taxonomies', 'wcfmcap_allowed_taxonomies_custom', 450, 3 );

    Category filtering is a core feature for WCfM Ultimate. But with this function it will work without WCfM Ultimate as well.

    Thank You

  • #23278

    dale
    Participant

    Thank you

The topic ‘Category limit not working’ is closed to new replies.