• Resolved ZILZAL

    (@zilzal)


    Hi,
    Is there a filter or code that will restrict a specific user or user role to see and edit only his own created orders in the backend ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @zilzal,

    We don’t have a code snippet ready to go, though it’s theoretically possible with custom code using the woocommerce_order_data_store_cpt_get_orders_query filter.

    However, if you’re unfamiliar with coding, I suggest using a plugin like WooCommerce Memberships or User Role Editor, which could help you manage user roles and capabilities more efficiently. These plugins allow you to define what each user role can and cannot do, including viewing and editing orders.

    I wish I could help more, but hopefully, this gets you going in the right direction to get the job done.

    Thread Starter ZILZAL

    (@zilzal)

    Hi @shameemreza,
    I tried User Role Editor , PublishPress Role Capabilities and Advanced Access Manager, none of these does have the ability to restrict the user to his own created orders only. it can restric accessing or editing all backend orders altoghether.

    Even the Woocommerce in the HPOS database table doesn’t store the ID or name of the user who created the order. And i was trying to figure out a way to do it, maybe using custom field, or meta key.

    • This reply was modified 1 year, 1 month ago by ZILZAL.
    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @zilzal,

    Although currently, WooCommerce doesn’t support this feature out of the box and doesn’t store the ID or name of the user who created the order in the database table, it’s possible to achieve this with custom code.

    You can add a custom field or meta key to the order that stores the ID of the user who created the order. Then, you can use the woocommerce_order_data_store_cpt_get_orders_query filter to modify the query that retrieves orders only to include orders that have the current user’s ID in the custom field.

    For reference, these particular forums are meant for general support with the core functionality of WooCommerce itself. For development and custom coding questions, it’s best to ask for insight related to those on either the WooCommerce Advanced Facebook group or the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:

    I wish I could help more, but hopefully, this gets you going in the right direction to get some further insight/information.

    Thread Starter ZILZAL

    (@zilzal)

    @shameemreza
    Thank you very much, i will start from where you pointed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Allow Manager to See and Edit only his own orders’ is closed to new replies.