The Merge Orders extension allows you to merge orders, combining the line items from multiple orders into one to process and ship them together.
- Download the .zip file from your WooCommerce account.
- Go to: WordPress Admin > Plugins > Add New and Upload Plugin with the file you downloaded with Choose File.
- 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.
To merge an order:
- Go to WooCommerce > Orders in the WordPress admin, and open one of the orders you wish to merge
- Click the Merge order button, which appears in the action buttons below the list of line items
![Merge orders button](https://woocommerce.com/wp-content/uploads/2020/11/merge-button.png?strip=all&w=704)
- 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](https://woocommerce.com/wp-content/uploads/2020/11/merge-dialog.png?strip=all&w=704)
- Add any other orders you wish to merge by repeating step 3
- Click the Complete Merge button to confirm the merge
- The orders selected will be merged into the current order. Refer to the order notes for links to the merged orders.
All line items from the selected orders are moved into the target order.
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.
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.
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).
There are no emails sent by default when you merge orders.
Yes, but orders being merged should be of the same currency.
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.
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.
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.
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 );
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 );