WiTon Nope
WiTon Nope

Reputation: 166

Woocommerce: I restrict users from managing certain categories and products?

I'm building a site selling ebooks and educational stuff. Has 2 supervisors should be assigned as Shop Manager however each supervisor is responsible of certain category and should not interrupt with the other supervisor.

Example: Product Category A,B,C,D

Supervisor 1 can manage and see Category A and B and related products but can't see C and D and related products. Supervisor 2 can manage and see Category C and D and related products but can't see A and B and related products.

How to restrict certain Woocommerce categories and related products by user id or role at the backend?

Upvotes: 0

Views: 1109

Answers (2)

axr
axr

Reputation: 11

maybe this will help

code from here

hide product categories from the dashboard by their IDs (1,17) and user abilities (current_user_can('editor')).

/*
 * Hide Specified Categories (by ID) from Editors
 */

add_action( 'admin_init', 'wpse_55202_do_terms_exclusion' );

function wpse_55202_do_terms_exclusion() {
    if( current_user_can('editor') )
        add_filter( 'list_terms_exclusions', 'wpse_55202_list_terms_exclusions', 10, 2 );
}

function wpse_55202_list_terms_exclusions($exclusions,$args) {
    return $exclusions . " AND ( t.term_id <> 1 )  AND ( t.term_id <> 17 )"; 
}

Upvotes: 1

Michael Vermeulen
Michael Vermeulen

Reputation: 187

For backend you could use a plug-in called "white label branding" it will allow you to select which options users will be able to change etc. It can be set by user role easily.

Upvotes: 0

Related Questions