Assign Orders

The Assign Orders extension allows you to manually or automatically assign customer orders to specific members of your team and to control access to orders.

Installation and Setup

↑ Back to top
  1. Download the .zip file from your WooCommerce account.
  2. Go to: WordPress Admin > Plugins > Add New and Upload Plugin with the file you downloaded with Choose File.
  3. Install Now and Activate the extension.

More information at: Install and Activate Plugins/Extensions.

After activating the extension, you will be able to manually assign orders and setup automatic assignment rules.

Usage

↑ Back to top

Manually Assigning an Order

↑ Back to top

To manually assign an order to a user:

  1. Go to WooCommerce > Orders in the WordPress admin, and open the order you wish to assign.
  2. Select the assignee from the list of users in the Assigned to field (screenshot below).
  3. Save changes to the order by clicking the Update button.

Automatic Assignment

↑ Back to top

Assignment rules provide a way of automatically setting the assigned user on orders, based on conditions you define. Automatic assignment is attempted every time the status of an order is updated.

Assignment rules can be managed from the settings page at WooCommerce > Settings > Assign Orders. The first assignment rule that meets its conditions will get applied to an order, so it is recommended to sort the rules in order of priority from top to bottom. Rules can be dragged to rearrange them.

Create Assignment Rules

↑ Back to top

To create a new assignment rule:

  1. Go to WooCommerce > Settings > Assign Orders.
  2. Select the user that any matching orders should be assigned to.
  3. Select the first condition and input the required parameters. The available conditions are described below.
  4. Add additional conditions by clicking the Add condition button. An order will need to match all the conditions you specify for the rule to be applied.
  5. When you click the Save rule button, the rule will be created and added to the bottom of the list of existing rules.

Available Conditions

↑ Back to top
  • Customer — order was (or was not) placed by a specific customer
  • Product — order contains (or does not contain) a specific product
  • Product category — order contains (or does not contain) a product in a specific category
  • Shipping country — order is (or is not) being shipped to a specific country
  • Billing country — order is (or is not) being billed to a specific country
  • Order total — order total is greater than, less than or equal to an amount
  • Order status — status of the order is (or is not) a specific status (supports custom statuses)

There is also an “All Orders” condition which will always match every order, so it can be used to create a catch-all rule.

Emails

↑ Back to top

When an order is assigned, either manually or automatically, an email can optionally be sent to the assignee. This email is disabled by default, but can be enabled from WooCommerce > Settings > Emails. An example of the email that gets sent is shown below.

Assignment email sent to assignee

The copy for this email can be configured from the email settings, and basic details about the order and customer are included automatically. If you need to make more substantial changes to the email, the template can be overridden in the same way as other WooCommerce email templates, by making a copy of the template file (assign-orders/templates/emails/admin-order-assigned.php) into the theme folder. 

FAQs

↑ Back to top

Can I assign an order to multiple users?

↑ Back to top

No. It’s currently only possible to assign an order to a single user.

Who can change the assignee on an order?

↑ Back to top

To edit an order’s assignee, the user must have the edit_other_assignees_shop_orders capability. By default, all shop managers have this capability. You can grant or retract this capability with any third-party plugin for managing roles and capabilities.

This behaviour can be customised with code snippets.

Who can view/edit orders assigned to other users?

↑ Back to top

By default, only users who have the edit_other_assignees_shop_orders capability will be able to see unassigned orders or orders assigned to other users. You can grant or retract this capability with any third-party plugin for managing roles and capabilities.

This behaviour can be customised with code snippets.

Code Snippets

↑ Back to top

Set the user assigned to an order

↑ Back to top

You can programmatically assign a specific user to an order by calling the static update_assignee method:

// Order instance
$order = wc_get_order( 123 );

// ID of the user to assign
$assignee = 101;

// Assign the order
Vibe\Assign_Orders\Orders::update_assignee( $order, $assignee );

Prevent automatic assignment on status change

↑ Back to top

If you are going to run the assignment rules yourself, you can disable them running on status change:

add_filter( 'vibe_assign_orders_auto_assign_on_status_change', '__return_false' );

Prevent automatic assignment for a specific order

↑ Back to top

Assignment rules will normally be run on all orders. This can be overridden with the vibe_assign_orders_auto_assign_order filter:

function vibe_assign_orders_prevent_auto_assignment( $should_assign, $order ) {
    // Do not auto assign if the order ID is 123
    if ( 123 == $order->get_id() ) {
        return false;
    }

    return true;
}
add_filter( 'vibe_assign_orders_auto_assign_order', 'vibe_assign_orders_prevent_auto_assignment', 10, 2 );

Override whether a user can see other assignees’ orders

↑ Back to top

To override which users can see unassigned orders and orders assigned to other users, you can use the vibe_assign_orders_user_can_see_other_assignees filter:

function vibe_assign_orders_can_see( $can_see, $user_id ) {
    // Override whether this user can see other assignee's orders
    if ( 101 == $user_id ) {
        return true;
    }

    return $can_see;
}
add_filter( 'vibe_assign_orders_user_can_see_other_assignees', 'vibe_assign_orders_can_see', 10, 2 );

Override whether a user can change an order’s assignee

↑ Back to top

By default, the same users that can see other assignees’ orders can also edit the assignee. To override this you can use the vibe_assign_orders_user_can_assign filter:

function vibe_assign_orders_can_edit( $can_edit, $user_id ) {
    // Override whether this user can edit the assignee field on orders
    if ( 101 == $user_id ) {
        return true;
    }

    return $can_edit;
}
add_filter( 'vibe_assign_orders_user_can_assign', 'vibe_assign_orders_can_edit', 10, 2 );
Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.