I wrote this code to create a custom user called "payment manager", this user should only edit/ view woo-commerce orders, Im have looked everywhere and didn't found any answer, see code:
function sitelab_simple_role() {
add_role(
'payment-manager',
'Payment Manager',
array(
'read' => true,
'edit_posts' => true,
'upload_files' => false,
‘manage_woocommerce’ => false,
'manage_woocommerce_orders' => true,
'edit_shop_order' => true,
'edit_shop_order_terms' => true,
'edit_shop_orders' => true,
'manage_shop_order_terms' => true,
'publish_shop_orders' => true,
'read_private_shop_orders' => true,
'read_shop_order' => true,
),
);
}
add_action( 'init', 'sitelab_simple_role' );
For some-reason it doesn't allow to edit order with error message "you are not authorized for this action"
What could it be?
Thanks for the helpers
You are missing a few capabilities.
array(
'read' => true,
'edit_posts' => true,
'upload_files' => false,
'manage_woocommerce' => false,
'manage_woocommerce_orders' => true,
'edit_shop_order' => true,
'edit_shop_order_terms' => true,
'edit_shop_orders' => true,
'manage_shop_order_terms' => true,
'publish_shop_orders' => true,
'read_private_shop_orders' => true,
'read_shop_order' => true,
'assign_shop_order_terms' => true,
'delete_others_shop_orders' => true,
'delete_private_shop_orders' => true,
'delete_published_shop_orders' => true,
'delete_shop_order' => true,
'delete_shop_order_terms' => true,
'delete_shop_orders' => true,
'edit_others_shop_orders' => true,
'edit_private_shop_orders' => true,
'edit_published_shop_orders' => true,
),