# Changelog

All notable changes to this plugin will be documented in this file.

---

## [1.2.0] - 2025-08-22

### Changed
- **Renamed plugin**: Updated plugin name to **MultiOrder Sync** across all files, settings, and documentation.
- **Terminology updates**:
  - Replaced all references to **"Primary Order"** with **"Parent Order"**.
  - Replaced all references to **"Secondary Order(s)"** with **"Linked Order(s)"**.
  - Updated meta keys, labels, API responses, and internal methods for consistency.
- Updated admin UI, REST API, and settings pages to reflect the new terminology:
  - Admin meta boxes and linked order displays use updated wording.

## [1.1.0] - 2025-08-18

### Changed
- Improved the metadata structure used to store linked orders:
  - Now, **all linked orders** (parent and linked) consistently store a `multipleorders` meta entry.
- Updated the following methods to support full metadata persistence:
  - `ajax_link_orders()` now updates meta for **all orders** in the group.
  - `ajax_unlink_orders()` now properly removes metadata from all related orders.
  - `ajax_get_linked_order_details()` now outputs accurate linked order data.
- Improved the admin **Linked Orders** meta box with a clearer UI and accurate link details.
- Refactored the plugin settings page (`render_settings_page()`):
  - Now uses server-rendered tabs based on the `?tab=` URL parameter.
  - Only the active tab’s template is loaded, improving performance and clarity.
- Removed dependency on frontend JavaScript for tab switching.
- Updated admin settings templates:
  - Wrapped each tab’s content in individual PHP templates.
  - Templates are now loaded conditionally based on the selected tab.

### Deprecated
- Legacy partial `multipleorders` meta structure used prior to v1.0.1:
  - Was only set for the parent order (or only for secondaries).
  - **Fallback retained temporarily for backward compatibility.**
  - ⚠️ **Deprecated:** This fallback will be removed in a future major release (e.g., `v2.0.0`). Please update any custom code depending on the old structure.

### Fixed
- Fixed inconsistencies in how linked orders were displayed in the admin UI.
- Fixed issue where some linked orders were not saving metadata correctly.

---

## [1.0.0] - 2025-08-13

### Added
- Initial release of the MultiOrder Sync plugin.
- Ability to group WooCommerce orders based on customizable criteria.
- Link grouped orders into primary/secondary relationships.
- Admin UI for managing grouped orders.
- Settings panel for:
  - Order criteria.
  - Email templates.
  - Admin emails and CC.
  - API key.
- REST API:
  - Fetch grouped orders across the network:  
    `GET /wp-json/emw-mom/v1/orders`
  - Get multiple order group by order ID:  
    `GET /wp-json/emw-mom/v1/multiple-order-group/{order_id}`
- Multisite support: Fetch orders across all network sites.
- API authentication via custom API key header (`X-EMW-MOM-API-Key`).
- Toggle REST API docs in plugin settings.

### Fixed
- None — initial stable release.

### Security
- REST API secured via API key and admin toggle.

---
