﻿=== OnlineFotka Split, Merge & Duplicate Orders ===
Contributors: onlinefotka
Tags: woocommerce, order, duplicate, copy order, order management
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 7.0
WC tested up to: 9.9
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Duplicate, split, or merge WooCommerce orders. All operations preserve line items, taxes (VAT), shipping, and custom meta.

== Description ==

**OnlineFotka Split, Merge & Duplicate Orders** gives you three powerful order management tools in one plugin. Duplicate any order in one click, split an order into two, or merge multiple orders into one. All operations fully preserve line items, taxes (VAT), shipping methods, and custom meta fields.

=== Features ===

**Duplicate**

* Bulk action — select one or more orders and choose "Duplicate" from the dropdown
* Order detail action in the "Order actions" metabox
* Copies all order data: addresses, line items (with tax class), fees, shipping, coupons, payment method, customer note, custom meta
* New order opens as Pending — fully editable before processing

**Split**

* "Split order" action in the Order actions metabox
* Choose which items (and quantities) to move to a new order
* Remaining items and quantities stay in the original order
* Both orders are recalculated — totals and taxes are recomputed correctly
* Option to copy shipping method to the new order

**Merge**

* Bulk action — select 2 or more orders and choose "Merge into one order"
* All line items, fees, and coupons from all selected orders are combined
* Duplicate shipping methods are deduplicated automatically
* Source orders receive a note with a reference to the merged order
* Merged order opens as Pending for review

=== HPOS & Legacy Compatible ===

* Declared compatible with WooCommerce High Performance Order Storage (custom_order_tables)
* Declared compatible with WooCommerce cart and checkout blocks
* Works with both the new `wc-orders` admin screen and the classic `edit-shop_order` screen

=== Translations ===

The plugin interface is available in the following languages:

* **English** (built-in)
* **Slovak** (sk_SK)
* **Czech** (cs_CZ)
* **Hungarian** (hu_HU)
* **German** (de_DE)

=== Requirements ===

* WordPress 6.0 or higher
* WooCommerce 7.0 or higher
* PHP 7.4 or higher

== Installation ==

1. Upload the `onlinefotka-split-merge-duplicate-orders` folder to `/wp-content/plugins/` or install via **Plugins → Add New**
2. Activate the plugin through the **Plugins** screen in WordPress
3. Go to **WooCommerce → Orders**, select orders, and choose **Duplicate** from the bulk actions dropdown

== Frequently Asked Questions ==

= Is the plugin compatible with HPOS? =

Yes. HPOS compatibility is explicitly declared and the plugin hooks into both the HPOS order screen (`woocommerce_page_wc-orders`) and the classic post-based screen (`edit-shop_order`).

= What data is copied to the new order? =

Billing and shipping addresses, all line items (products, variations, quantities, prices, taxes), fee items, shipping methods, coupon codes, payment method and title, customer note, and any custom order meta — except internal WooCommerce keys like `_order_key` and `_transaction_id`.

= What status does the duplicated order get? =

The new order is set to **Pending payment** so it is fully editable and will not trigger any automated fulfilment until you intentionally process it.

= Can I duplicate multiple orders at once? =

Yes. Select the orders using the checkboxes in the order list and choose **Duplicate** from the bulk actions dropdown.

= Will the original order be modified? =

Only an order note is added to the original order referencing the new duplicate. No other data is changed.

== Screenshots ==

1. Bulk actions dropdown in the WooCommerce orders list with the "Duplicate" option
2. Success notice after duplication with a link to the source order
3. "Duplicate order" action in the Order actions metabox on the order detail page

== Changelog ==

= 1.1.0 =
* New: Split order — move selected items/quantities from one order to a new order
* New: Merge orders — combine 2 or more orders into one via bulk action
* Improved: tax_class is now explicitly copied on all line items and fees
* Improved: split recalculates taxes proportionally using the original tax rate arrays

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.1.0 =
Adds split and merge order features. No database changes — safe to update.

= 1.0.0 =
Initial release.
