=== Contrado Integration for WooCommerce ===
Contributors: contrado
Tags: woocommerce, print-on-demand, contrado, product sync, order sync
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Requires Plugins: woocommerce
Stable tag: 1.0.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sync Contrado print-on-demand products, collections, and orders with your WooCommerce store.

== Description ==

Contrado Integration for WooCommerce connects your store to the [Contrado](https://www.contrado.co.uk) print-on-demand platform via the Helix API. It keeps your products, stock levels, and order statuses in sync automatically.

Dropship 470+ exceptional print-on-demand products for your boutique with wholesale specialists.

Join our exclusive programme and elevate your brand with luxurious, handmade products. Dropship manually under your own brand name using our branding station. No inventory needed. Enjoy larger-quantity offerings while keeping your own brand prominent. Seamlessly transition and explore future opportunities. For more information, contact customer support.

* Product range: 470+ products including clothing, homeware, wall art, game mats, and more.
* Sustainable, premium-quality products ready for dropshipping.
* Worldwide fast fulfilment: made on demand in 1-3 days and delivered in 1-4 days.
* Complete branding station to support your dropship printing needs.
* Playmats and Mahjong mats: custom printed and made on demand.

**Features**

* **Full product sync** — Import your entire Contrado catalogue as WooCommerce variable products, complete with attributes, variations, images, and pricing.
* **Collection sync** — Import products from a single Contrado collection.
* **Order sync** — Import Contrado order live fulfilment status updates.
* **Out-of-stock variation hiding** — OOS variations are removed from the product-page dropdowns in real time so customers can never add unavailable options to their cart.
* **Discontinued product cleanup** — Products no longer in your Contrado catalogue are permanently removed from WooCommerce on a full sync.
* **Webhook support** — Receive real-time push updates from Contrado for stock changes, design modifications, and order status changes.
* **HPOS compatible** — Fully compatible with WooCommerce High-Performance Order Storage.
* **Tabbed admin UI** — A dedicated top-level admin page with Sync and Support tabs, live progress bar, and post-sync statistics (synced / failed / total).

**External Services**

This plugin connects to the **Contrado Helix API** to retrieve product and order data and to submit orders for fulfilment. The API endpoint is configured by the store owner under *WooCommerce → Settings → Integrations → Contrado Integration for WooCommerce*. No data is sent to Contrado without the store owner explicitly configuring their API credentials and triggering a sync.

Please review the Contrado [Privacy Policy](https://www.contrado.co.uk/privacy-policy) and [Terms of Service](https://www.contrado.co.uk/terms-and-conditions) before use.

== Installation ==

1. Upload the `contrado-integration-for-woocommerce` folder to your `/wp-content/plugins/` directory, OR install it directly through the WordPress admin by going to *Plugins → Add New → Upload Plugin* (and uploading the `.zip` file).
2. Activate **Contrado Integration for WooCommerce** through *Plugins → Installed Plugins*.
3. Go to **WooCommerce → Settings → Integrations → Contrado Integration for WooCommerce** and enter:
   * **API Base URL** — your Contrado Helix API endpoint (e.g. `https://api.contrado.app/helix/v1`).
   * **API Key** — your Contrado API key (stored encrypted in the database).
4. Click **Test Connection** to verify your credentials.
5. Copy the generated **Webhook URL** and register it in your Contrado account under *API Integration → Webhook*.
6. Navigate to **Contrado** in the WordPress admin sidebar and run your first sync.

== Frequently Asked Questions ==

= Does this plugin work without WooCommerce? =

No. WooCommerce 8.0 or later must be installed and active.

= Which Contrado currencies are supported? =

GBP, USD, EUR, AUD, CAD, NZD, AED, JPY, and SEK. For EUR stores, the site locale determines the exact culture code (de-DE, fr-FR, es-ES, etc.).

= What happens to products removed from Contrado? =

On a full catalogue sync, any WooCommerce product not returned by the Contrado API is permanently deleted. A webhook event (`ProductDiscontinue`) will also remove a product immediately when received.

= Are my API credentials stored securely? =

Yes. The API key is encrypted before being stored in the WordPress database using AES-256 encryption derived from the WordPress security keys.

= Can I sync only some products? =

Yes. Use the **Sync by Collection** card on the admin page to import products from a single Contrado collection.

= Does large catalogues cause timeouts? =

No. Product sync uses WooCommerce's Action Scheduler to process products in background batches, so timeouts are not an issue regardless of catalogue size.

== Screenshots ==

1. The Contrado admin page — Sync tab showing all three sync cards with last-sync statistics.
2. The API settings page — API credentials and webhook URL configuration.

== Changelog ==

= 1.0.0 =
* Initial release.
* Full product and variation sync with out-of-stock hiding.
* Order submission and status sync.
* Webhook receiver for real-time stock, design, and order status updates.
* Tabbed admin UI with live progress bar and sync statistics.
* Top-level admin menu with branded icon.
* Discontinued product auto-deletion on full sync.
* HPOS (High-Performance Order Storage) compatibility.

== Upgrade Notice ==

= 1.0.0 =
Initial release — no upgrade required.
