Import access for Shop Manager

Hello,

I would like to give the User import access to WooCommerce Shop Manager role, but it doesn’t look like there is a plugin setting for it.

Is there any code snippet that I can use to do so?

Please let me know. Thank you very much.

5 Responses to Import access for Shop Manager

  1. codeengine April 24, 2019 at 9:24 am #

    Hello,

    I don’t want to give Shop Manager users manage_options capability, or I may as well make them Admin users.

    Is there any way for the Import plugin to require manage_woocommerce instead of manage_options?

    Please let me know. Thank you!

    • Denitsa April 24, 2019 at 10:24 am #

      Hey there,
      The manage_options capability requirement is hard-coded in the plugin’s code. What you can do, although a bit hackish, is search-replace manage_options with manage_woocommerce in the plugin’s code files. It is the fastest, most straightforward solution to implement in this case, but bear in mind that you’d have to do that on every plugin update.
      Cheers,
      Denitsa

    • codeengine April 24, 2019 at 10:52 am #

      Thanks for the information.

      It would be great in if in the future access rights can be managed from the plugin settings. Can you please consider this a feature suggestion?

      Thank you.

      • Denitsa April 24, 2019 at 12:52 pm #

        Sure, that sounds like a handy feature to have. I’ll mark this topic as a feature request so we can consider implementing this kind of functionality in future versions of the plugin. Thanks for your suggestion! 🙂
        Cheers,
        Denitsa

  2. Denitsa April 23, 2019 at 1:19 pm #

    Hey there,
    To be able to access the User Import menu, the Shop Manager should be granted the manage_options capability. Bear in mind that this capability allows access to various settings in the dashboard (reference Codex page here -> https://codex.wordpress.org/Roles_and_Capabilities#manage_options).
    You can create a new group, assign the manage_options capability to it, and then add the Shop Manager users to that group.
    There is, of course, a way to do this via code if you’d prefer to add the manage_options capability to the Shop Manager role directly, although that won’t be the wisest solution. Still, here’s a function that would do the job:
    function change_shop_manager_capabilities() {
    $shop_manager_role = get_role( 'shop_manager' );
    if( '' != $shop_manager_role ) {
    $shop_manager_role->add_cap( 'manage_options' );
    }
    }

    Let me know if this works for you!
    Cheers,
    Denitsa

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share