Merge Orders

The Merge Orders extension allows you to merge orders, combining the line items from multiple orders into one to process and ship them together.

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, the merge order function will be available for use on all orders, no additional configuration is necessary.

Usage

↑ Back to top
To merge an order:
  1. Go to WooCommerce > Orders in the WordPress admin, and open one of the orders you wish to merge
  2. Click the Merge order button, which appears in the action buttons below the list of line items Merge orders button
  3. The dialog below will open. Use the select box to choose orders to be included in the merge and click the Add to merge button. Merge orders dialog
  4. Add any other orders you wish to merge by repeating step 3
  5. Click the Complete Merge button to confirm the merge
  6. The orders selected will be merged into the current order. Refer to the order notes for links to the merged orders.

FAQs

↑ Back to top

What data is merged into the target order?

↑ Back to top
All line items from the selected orders are moved into the target order.

What data is not merged into the target order?

↑ Back to top
Only line items are merged into the target order, all other data including customer details, billing address and shipping address are left unchanged. Support for copying or merging additional items of data can be added in code snippets using the available hooks. Further information is below.

How are line items merged into the target order?

↑ Back to top
When merging, product line items will be combined in to one line item (by increasing the quantity), if the product was sold at the same unit price on both the orders. If there is a matching product, but it was sold at a different unit price, it will be added as a separate line item. This default behaviour can be modified using a code snippet (details below). Other types of line item (such as shipping) will always be added as separate line items on the target order.

What happens to orders that have been merged into another order?

↑ Back to top
When an order is merged into another, all of its line items are removed and added to the target order. By default, these orders will be then given the custom status Merged and will remain visible in the orders view to maintain the order history. It is possible to either assign a different order status or to delete a merged order entirely using a code snippet (see below).

Are customer emails sent when orders are merged?

↑ Back to top
There are no emails sent by default when you merge orders.

Does this extension support multi-currency?

↑ Back to top
Yes, but orders being merged should be of the same currency.

Can you merge an order into another more than once?

↑ Back to top
Once an order has been merged into another, the line items will be removed from the original order and cannot be merged again. The merged orders are given the status ‘merged’ and will be excluded from the list of potential orders to merge. You can merge into the same order as many times as you wish.

Can merged orders still be refunded?

↑ Back to top
Yes, you can process refunds for any merged line items from the order they were merged into. However, depending on the payment gateway, it may not be possible to process automatic refunds for more than the original order total. In this scenario the refund would need to be processed manually.

Code Snippets

↑ Back to top
These snippets are intended for use by developers. To use them you will need to add the code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin.

Delete merged orders

↑ Back to top
By default merged orders are given the status ‘merged’, the following code snippet will instead cause them to be deleted after merging.
function merge_orders_delete_merged( $target, $merged ) {
    foreach ( $merged as $order ) {
        $order->delete( true );
    }
}
add_action( 'vibe_merge_orders_after_orders_merged', 'merge_orders_delete_merged', 10, 2 );

Change the product line item merge strategy

↑ Back to top
The plugin provides three different strategies for how product line items should be handled when merging orders. Change the return value in the snippet to one of the below to achieve the required behaviour. default – Merge line items for the same product only if they share the same unit price merge – Always merge line items for the same product separate – Never merge line items for the same product
function merge_orders_change_strategy( $strategy, $target, $orders ) {
    return 'separate';
}
add_filter( 'vibe_merge_orders_product_item_strategy', 'merge_orders_change_strategy', 10, 3 );