Change WordPress user roles and capabilities Forums How to or FAQ Duplicate product – shop manager

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #7529
    centroil
    Participant

    Hi,
    I have created a shop manager role but now I notice that he lose the capability to duplicate products. I do not find that capability in the list.
    What should I do to make the shop manager able to duplicate a product?

    Thanks for support.
    Have a nice day

    Michele

    #7532
    Vladimir
    Keymaster

    Hi Michele,

    WooCommerce by default uses ‘manage_woocommerce’ capability for ‘Duplicate’ link under products. It’s possible to replace it with something other using provide custom filter ‘woocommerce_duplicate_product_capability’, like this:

    
    add_filter('woocommerce_duplicate_product_capability', 'wc_duplicate_product_cap', 10, 1);
    function wc_duplicate_product_cap( $cap ) {
      $cap = 'edit_products';
      return $cap;
    }
    
    #7543
    centroil
    Participant

    Thanks so much Vladimir, really!
    Michele

    #7617
    ataeipour
    Participant

    Hi Vladimir,
    what is the place to add this code filter?
    Because when I try to add capability only have the option to add title and not places to add for code.
    can you please help me to find a place to add this code?

    #7618
    Vladimir
    Keymaster

    Hi ataeipour,

    You can add such code to the functions.php file of your active theme.

    #7621
    ataeipour
    Participant

    Hello again Vladimir,
    Thank you for your help and I did fix my issue with the Duplicate product capability, but I have the same issue with(Add New product capability) and can not find this capability separately on the capability list. if I check (manage_woocommerce) then New product it is shows up for the user on the backend but I don’t want to check this capability please let me know how I can add this capability separately like the duplicate product?
    Thank you.

    #7622
    ataeipour
    Participant

    Thank you I found the problem and solve it.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.