phpwordpresswoocommercebackendcapability

how to allow a role editor to manage woocommerce taxonomies in worpdress?


I want the role Editor to have access to all woocommerce management, I managed to do so by adding capabilities to this role:

    $role = get_role( 'editor' );
    $role->add_cap( 'manage_woocommerce_products' );
    $role->add_cap( 'manage_woocommerce_taxonomies' );
    $role->add_cap( 'manage_woocommerce_orders' );
    $role->add_cap( 'manage_woocommerce' );
    $role->add_cap( 'view_woocommerce_reports' );
    $role->add_cap( 'manage_woocommerce_coupons' );

    $role->add_cap( 'edit_product' );
    $role->add_cap( 'read_product' );
    $role->add_cap( 'delete_product' );
    $role->add_cap( 'edit_products' );
    $role->add_cap( 'publish_products' );
    $role->add_cap( 'read_private_products' );
    $role->add_cap( 'delete_products' );
    $role->add_cap( 'delete_private_products' );
    $role->add_cap( 'delete_published_products' );
    $role->add_cap( 'edit_private_products' );
    $role->add_cap( 'edit_published_products' );
    $role->add_cap( 'edit_products' );

Every thing seems to work ok except the products categories and tags, I have been searching but nothing, i guess there has to be a capability for it but I don't know which one, Hope some expert can guide me a bit on this.

Thanks a lot.


Solution

  • if you read this, you can see that woocommerce recommend two plugins to work, try: this or this

    Or try adding this capabilities

    1. manage_product_terms
    2. edit_product_terms
    3. delete_product_terms
    4. assign_product_terms
    5. manage_categories