Change WordPress user roles and capabilities › Forums › Restrict or Permit access inside WordPress – how to › Restrict Orders View – 2
Tagged: WooCommerce Orders
- This topic has 20 replies, 3 voices, and was last updated 6 years, 2 months ago by Vladimir.
-
AuthorPosts
-
10/04/2016 at 18:52 #2196shackbillParticipant
I have several users roles (cashiers) that can create orders in WOoCommerce. I gave them each edit_shop_orders as you suggested in this post (https://www.role-editor.com/forums/topic/woocommerce-restrict-to-view-of-orders/) so they can see all orders and process refunds.
My problem is this… I only want them to be able to view their own orders (ideally, remove the ALL and completed options seen in the attachment). If i do this with CSS, then the admin cant see them either. Is there a way to create a capability so that i can apply it to the cashiers?
11/04/2016 at 11:18 #2200VladimirKeymasterThis module may help:
It does not contain ‘view own items’ option yet. But if you input this user ID to the ‘Restrict by author’ field:
he will see his own products only.
Development version 4.25 (beta) (available at the same download page after login) includes a fix for the orders. So if you have a test copy you may test how it will work in your case.11/04/2016 at 15:43 #2201shackbillParticipantOK i updated to 4.25b3. Perhaps i am looking in the wrong place but i dont see the option to check ‘with author id’ see my attachment please.
So in the future soon you will add ‘view own items’ only option because with many users it will be difficult to add ID all the time? thanks.
12/04/2016 at 02:34 #2202VladimirKeymaster‘With’ author user ID’ field is currently available if user has ‘edit_others_%’ capability.
Yes, I will add this feature definitely.
I understand a problem and version 4.25 (currently in beta state) makes a step forward. It’s capable to set edit restrictions for roles, where it will be much easier to set in case of large quant of users to restrict.12/04/2016 at 03:01 #2203shackbillParticipantOk if i understand what you mean see the images attached.
1. I add ‘edit_others_posts’ capability to user_id 11
2. i add ’11’ to the ‘with author user Id’but i still see other users when user 11 is logged in. see images attached please.
Thanks for your help.
12/04/2016 at 03:22 #2204VladimirKeymasterOrders are filtered by product owner ID = this user ID, that is 11, not by “Ship To” field value.
12/04/2016 at 03:57 #2205VladimirKeymasterIt seems you need some other logic then one which was realized currently. And it’s something special.
In general WooCommerce order could be placed by any visitor, which automatically becomes a customer. Customers don’t have access to the admin back-end.
When we talk about ability of someone to see/edit his own orders only, I mean a user like a vendor (products owner), which sees/edits just orders placed for his products.12/04/2016 at 04:05 #2206VladimirKeymasterYes but this is a POS CASH REGISTER orders are placed by whoever is current logged in user.
Thanks. I will add an option via filter to restrict orders by order owner or by product owner (default).
17/04/2016 at 04:57 #2247VladimirKeymasterIf you have a test environment try development version (current is 4.25.b5). It’s available after login from the same download page.
I added a filter, which allows to switch off order, which added by default according to the product owner ID. So add it to the theme’s functions.php or set up this code as the ‘must-use’ plugin.
add_filter('ure_edit_posts_access_add_orders_by_product_owner','ure_add_orders_by_product_owner',10,1); function ure_add_orders_by_product_owner($value) { return false; }
17/04/2016 at 05:06 #2248shackbillParticipantNot sure i understand completely.. i installed the Beta just now. do i ALSO need to add the code to functions.php or set ‘must-use’ i am not sure what ‘must-use’ is? thanks.
17/04/2016 at 05:20 #2249VladimirKeymasterAbout WordPress “must-use” plugins: https://codex.wordpress.org/Must_Use_Plugins
Yes, you need to add the code to fully exclude the order from other users. They are included by default for products, where this user is an owner.
17/04/2016 at 05:26 #2250shackbillParticipantok i added code to functions.php in child theme. but i still see other orders when i click ALL. Is there a capability i should check also?
17/04/2016 at 05:47 #2251VladimirKeymasterAre the previously discussed settings (editing restricted by author ID) still active for this user?
17/04/2016 at 05:49 #2252shackbillParticipantYes this one here.
17/04/2016 at 05:53 #2253shackbillParticipantthis is just a dev site would you like me to send you admin access so you can see?
-
AuthorPosts
- You must be logged in to reply to this topic.