=== Malenko OMS Sync for WooCommerce ===
Contributors: malenko123
Tags: woocommerce, oms, order management, order sync, api
Requires at least: 6.5
Tested up to: 6.9
Stable tag: 1.0.1
Requires PHP: 8.0
WC requires at least: 7.0
WC tested up to: 9.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect WooCommerce to any Order Management System (OMS) via REST API. Built for developers and agencies managing custom or proprietary OMS platforms.

== Description ==

Malenko OMS Sync for WooCommerce is a developer-friendly plugin that automatically pushes completed WooCommerce orders to any Order Management System that accepts orders via a REST API endpoint.

If your client has a custom-built OMS, an internal order management system, or any platform that exposes a REST API — this plugin handles the connection without any custom development.

= Who Is This For? =

* **Developers and agencies** building WooCommerce stores that need to connect to a client's existing OMS
* **Businesses** running a custom or proprietary OMS that accepts orders via REST API
* **Anyone** who needs a reliable, standards-compliant order sync without building it from scratch

= How It Works =

1. Configure your OMS endpoint URL and API key under WooCommerce → Settings → OMS Sync
2. When an order reaches **Completed** status, the plugin automatically pushes the order data to your endpoint
3. The OMS response is stored on the order and logged
4. If the sync fails, retry with one click from the order detail screen — no status change needed

= What Gets Sent =

The plugin sends a JSON payload to your configured endpoint containing:

* Order ID and order number
* Total amount and currency
* Customer email, name, and phone
* Billing and shipping addresses
* Line items including product name, SKU, quantity, and line total
* Order creation timestamp

= Features =

* Automatic order sync when orders reach Completed status
* Configurable endpoint URL, API key (Bearer token), and request timeout
* Full error handling — WP transport errors and non-2xx HTTP responses
* All sync activity logged to WooCommerce → Status → Logs
* OMS sync status panel on every order detail screen
* Manual retry button for failed syncs — no status change required
* Duplicate sync guard — prevents double-pushing the same order
* Enable/disable sync without deactivating the plugin
* Fully compatible with WooCommerce HPOS (High Performance Order Storage)

= Testing Without a Real OMS =

Use [webhook.site](https://webhook.site) as a free mock endpoint during development. Paste your unique URL into the endpoint field, complete a test order, and see the exact JSON payload your OMS will receive in real time.

= For Developers =

* Clean class-based architecture — dedicated API client, logger, and order sync classes
* Singleton pattern throughout
* All order data via WooCommerce CRUD — full HPOS compatibility
* No direct post meta access on orders
* Validated against WordPress Coding Standards (PHPCS/WPCS)
* PHPUnit test suite included

== Installation ==

= From WordPress.org =

1. Go to **Plugins → Add New** in your WordPress admin
2. Search for "Malenko OMS Sync for WooCommerce"
3. Click **Install Now** then **Activate**
4. Go to **WooCommerce → Settings → OMS Sync**
5. Enter your OMS endpoint URL and optional API key
6. Save settings

= Manual Installation =

1. Download the plugin ZIP
2. Go to **Plugins → Add New → Upload Plugin**
3. Upload the ZIP and click **Install Now**
4. Activate the plugin
5. Configure under **WooCommerce → Settings → OMS Sync**

**Note:** WooCommerce must be installed and active before activating this plugin.

== Frequently Asked Questions ==

= Which OMS systems does this support? =

Any OMS that accepts orders via a REST API POST endpoint and expects JSON. The plugin sends a standardized JSON payload — as long as your OMS can receive it, this plugin will work.

= What authentication is supported? =

Bearer token authentication via API key. The key is sent in the Authorization header with every request. Leave the API key field empty if your OMS does not require authentication.

= What happens if the sync fails? =

The failure is logged to WooCommerce → Status → Logs and recorded on the order. The OMS Sync Status panel on the order screen shows the error message. You can retry manually with one click — no order status change required.

= Is this compatible with WooCommerce HPOS? =

Yes. Fully compatible with High Performance Order Storage. All order reads and writes use WooCommerce CRUD methods — no direct post meta access on orders anywhere.

= Where are the logs? =

Go to WooCommerce → Status → Logs and select `oms-sync-for-woocommerce` from the dropdown. All sync activity is logged there including successful syncs, failures, and retry attempts.

= Will this work with Linnworks, Brightpearl, or Cin7? =

The free version works with any OMS via generic REST API. Native integrations for specific OMS platforms with their own authentication flows are planned for a future premium version.

= Does the plugin store any customer data locally? =

The plugin stores the OMS sync status, timestamp, and API response on the order in WooCommerce order meta. No customer data is stored separately — it remains part of the WooCommerce order as normal.

== Screenshots ==

1. OMS Sync Status panel on the order detail screen showing a successful sync
2. OMS Sync Status panel showing a failed sync with error detail and retry button
3. Plugin settings page under WooCommerce → Settings → OMS Sync

== Changelog ==

= 1.0.1 =
* Added: oms_sync_after_successful_sync action hook for clean integration with Pro extensions
* Maintenance update — no breaking changes
* Initial release
* Automatic order sync on completion via REST API
* Bearer token authentication support
* Admin status panel with manual retry button
* WooCommerce Settings tab
* Full HPOS compatibility
* WC_Logger integration
* PHPUnit test suite included

== Upgrade Notice ==

= 1.0.0 =
Initial release.

== Privacy Policy ==

This plugin sends WooCommerce order data to a third-party REST API endpoint configured by the site administrator under WooCommerce → Settings → OMS Sync.

The data transmitted includes order details such as:

* Customer name, email address, and phone number
* Billing and shipping address
* Purchased products, quantities, and prices
* Order total and currency

No data is collected, stored, or transmitted by the plugin author. All data is sent directly from your WordPress site to the OMS endpoint URL you configure. The plugin author has no access to this data.

It is the responsibility of the site administrator to ensure their OMS provider handles data in compliance with applicable privacy regulations (such as GDPR), and to update their site's privacy policy to reflect that order data is shared with their Order Management System.