The Clone Orders extension adds functionality for duplicating orders to streamline the process of adding similar orders quickly. The clone will be assigned to the same customer with shipping and billing details copied from the original order.
Installation and Setup
↑ Back to top- 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 clone order function will be available for use on all orders, no additional configuration is necessary.
Usage
↑ Back to topTo clone an order:
- Go to WooCommerce > Orders in the WordPress admin, and open the order you wish to clone
- Click the Clone order button, which appears in the action buttons below the list of line items
- The dialog (shown below) will open. Select whether to include the line items in the clone or not.
- Click the Complete clone button to confirm
- A new order will be created as a clone of the original. A link to the new order will be displayed in the confirmation notice, to allow you to navigate straight to it.
An alternative method of cloning from the order listing screen is available using the two clone buttons in the Actions column. There is one button to clone with line items and another to clone without them.
Settings
↑ Back to topThe Clone orders setting page can be found at WooCommerce > Settings > Advanced > Clone orders. The settings described below can be used to alter the default clone behaviour.
Clone available stock only
By default, all line items will be cloned regardless of available stock. Check the “Available stock only” setting option if you would like only line items with sufficient stock (or products that allow backorders) to be cloned. With this option checked, if only part of the item quantity can be fulfilled within the available stock, the clone will receive only this quantity. If no stock is available, then the item will not be cloned to the new order.
Additional fields
By default, non-standard fields will not be copied when performing a clone. This is because many fields are specific to the individual order (for example, order tracking data or a sequential order number), and it would be inappropriate to copy them. However if you do have additional fields you would like included in a clone, these can be added by listing them in the Available fields option.
FAQs
↑ Back to topWhat data is copied to a clone order?
↑ Back to topThe following data is copied to a clone:
- Line items (optionally) – including products, fees, shipping, coupons
- Line item meta
- Order status
- Customer
- Billing address
- Shipping address
- Customer note
- Date created
- Tax status
- Customer IP
- Customer user agent
What data is not copied to a clone order?
↑ Back to top- Order notes are not copied to the new order
- Order meta data added by other plugins will not be copied by default. Additional meta data fields can be input on the settings page to have them included in the clone. Note that although order meta is not copied to the clone, all line item meta is copied.
Are customer emails sent when an order is cloned?
↑ Back to topTo avoid customer confusion, the default WooCommerce emails are prevented from sending during a clone. This includes the following:
- Customer – processing order
- Customer – completed order
- Customer – refunded order
- Customer – on-hold order
The following admin emails are also disabled during a clone:
- Admin – new order
- Admin – cancelled order
- Admin – failed order
If you have additional email types added by other plugins, that are triggered by the creation of an order, then they could still be sent.
Are stock levels reduced when an order is cloned with items?
↑ Back to topYes. If the status of the new order will be one of processing, completed or on-hold, then the stock levels will be reduced for any line items included in the clone. This default functionality can be prevented using a code snippet.
Does the extension support sequential order numbers?
↑ Back to topYes. The plugin supports the Sequential Order Numbers Pro extension, so cloned orders will be assigned order numbers as defined in your settings for that extension.
Code Snippets
↑ Back to topThese 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.
Restore emails when cloning
↑ Back to topBy default WooCommerce emails are disabled as part of a clone. If you want them to be enabled you can use the following snippet:
add_filter( 'vibe_clone_orders_disable_emails', '__return_false' );
Prevent line item meta data being cloned
↑ Back to topIf you clone with line items, any meta data attached to the line items is also copied. If you wish to prevent this happening for specific meta fields you can do this using the following code snippet.
function clone_line_item( $target_item, $source_item, $target_order, $source_order ) { $target_item->delete_meta_data( 'my_item_meta' ); return $target_item; } add_filter( 'vibe_clone_orders_line_item', 'clone_line_item', 10, 4 );
Set status of new order
↑ Back to topBy default the status assigned to a clone is the same as the original order. To set the status of all clones to ‘pending’ the following snippet can be used:
function clone_order_status( $status ) { return 'pending'; } add_filter( 'vibe_clone_orders_clone_order_status', 'clone_order_status' );
Prevent the date and time being cloned
↑ Back to topThe date and time will be copied from the original order. Depending on your use case, you may prefer the new order to be set to the current date and time. The following snippet will do this.
add_filter( 'vibe_clone_orders_clone_date_created', '__return_false' );
Prevent stock levels being reduced
↑ Back to topBy default, when performing a clone, stock levels will be reduced for any line items in the order, only if the order status of the clone is one of processing, completed or on-hold. The following code snippet will prevent stock levels from being updated.
add_filter( 'vibe_clone_orders_reduce_stock', '__return_false' );
Reduce stock levels for custom order statuses
↑ Back to topBy default, stock levels will only be reduced for orders with a status of processing, completed or on-hold to be consistent with WooCommerce core. If you want stock levels to be reduced for other statuses too, including any custom statuses you are using, then the following code snippet will do this. This will add ‘picking’ and ‘shipping’ to the statuses that will trigger stock reductions in clones.
function clone_orders_reduce_stock( $should_reduce_stock, $new_order ) {
$statuses = array( 'picking', 'shipping' );
return $should_reduce_stock || in_array( $new_order->get_status(), $statuses );
}
add_filter( 'vibe_clone_orders_reduce_stock', 'clone_orders_reduce_stock', 10, 2 );
Add order notes to record clone
↑ Back to topThe following code snippet will add a private order note to both the new clone order and the original order, to identify and link to the order it was cloned from/to.
function vibe_clone_order_notes( $new_order, $original_order ) {
// Add order note to the new clone
$message = sprintf('Order cloned from <a href="%1$s">#%2$s</a>.',
$original_order->get_edit_order_url(),
$original_order->get_order_number()
);
$new_order->add_order_note( $message, 0, false );
// Add order note to the original order
$message = sprintf('Order cloned to <a href="%1$s">#%2$s</a>.',
$new_order->get_edit_order_url(),
$new_order->get_order_number()
);
$original_order->add_order_note( $message, 0, false );
}
add_action( 'vibe_clone_orders_after_order_cloned', 'vibe_clone_order_notes', 10, 2 );