Hi Guys,

This article is related to WooCommerce Product Vendors plugins  which gives your store a  multi-vendor marketplace. This article provides you with a source code to reconfigured vendor capability to access the WordPress dashboard.  Copy the source code and paste on to your theme functions file or any where inside your plugins.

 //rewrite the vendor capabilities
add_filter( 'wcpv_default_manager_vendor_role_caps', 'theme_slug_rewrite_vendor_capabilities_on_admin_side' );
//rewrite the vendor capabilities
add_filter( 'wcpv_default_admin_vendor_role_caps', 'theme_slug_rewrite_vendor_capabilities_on_admin_side' );

/**
* @param array of $current_capabilities vendor caps
* @return rewritten vendor caps
* @see https://codex.wordpress.org/Roles_and_Capabilities
*/
function theme_slug_rewrite_vendor_capabilities_on_admin_side( $current_capabilities ) {
	return array(
		'read_product'             => false,
		'manage_product'           => false,
		'edit_products'            => false,
		'edit_product'             => false,
		'edit_published_products'  => false,
		'edit_shop_orders'         => false,
		'assign_product_terms'     => false,
		'upload_files'             => true,
		'read'                     => true,
		'manage_bookings'          => false,
		'edit_others_products'     => false,
		'delete_posts'             => false,
		'delete_product'           => false,
		'edit_comment'             => false,
		'edit_comments'            => false,
		'view_woocommerce_reports' => false,
		'publish_products'         => false,
	);
}	

Note: You can mark the array value ,true or false as per your requirements. See here for full reference of WordPress capabilities

Note: After you are all set, do not forget to disable and enable the WooCommerce product vendor plugins. Vendor plugin reset roles after plugin deactivation.

 

Thanks

Advertisement

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: