=== CleverConnected Product Sync ===
Contributors: ambition4clients
Tags: woocommerce, product sync, inventory, pricing, api
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.4.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sync WooCommerce product data such as availability, price, and sale period with CleverConnected.

== Description ==

This plugin synchronizes WooCommerce product data with CleverConnected through an API endpoint. CleverConnected provides the product updates; the plugin applies those changes locally in WordPress.

Key features:

* Manual or scheduled synchronization via WordPress cron.
* Dry-run support for safe testing without saving changes.
* Selectable fields: availability, price, sale_price, and sale_period.
* Automatic SKU selection for local products with a 13-character SKU.
* Optional manual SKU list and `updated_since` filter.
* Local application of CleverConnected changes in WooCommerce.

Setup:

1. Go to **Settings > CleverConnected product sync** in the WordPress admin.
2. Enter the API base URL, domain name, and access token.
3. Optionally choose dry-run, fields, SKU filter, and updated_since.
4. Save and run manually, or let cron run on schedule.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Open **Settings > CleverConnected product sync** and configure the settings.

== Frequently Asked Questions ==

= Is dry-run safe for testing? =

Yes. With dry-run enabled, changes are not saved in WooCommerce.

= What happens if I leave the SKU list empty? =

The plugin automatically selects local WooCommerce products with a SKU of exactly 13 characters. Out-of-stock products are skipped.

= Which fields are supported? =

`availability`, `price`, `sale_price`, and `sale_period`.

= Does CleverConnected update my shop directly? =

No. The plugin requests update data from CleverConnected and applies the changes locally in WooCommerce.

== Changelog ==

= 1.4.1 =
* Tested up to WordPress 7.0.
* Load plugin textdomain and add languages template file.
* Remove discouraged set_time_limit() usage.
* Prefix uninstall script variables per WordPress coding standards.

= 1.4 =
* Apply CleverConnected updates locally in WordPress instead of relying on remote WooCommerce REST writes.
* Parse CleverConnected API responses with `before`/`after` item data.
* Automatically select 13-character SKUs and skip out-of-stock products by default.
* Prevent null or zero sale prices from creating free products.
* Ignore API sync metadata such as `status` on WooCommerce products.
* Security, escaping, and WordPress.org compatibility improvements.
* Removed development debug output from the admin sync result.

= 1.3 =
* Updated API payload to the new endpoint model with access_token and domain.
* Added support for `product_selector.skus` and `updated_since`.
* Added dry-run support in settings and synchronization flow.
* Added configurable fields (`fields`).
* Improved plugin headers for WordPress.org compatibility.

== Upgrade Notice ==

= 1.4.1 =
WordPress.org Plugin Check compatibility: WordPress 7.0 tested header, textdomain loading, and coding standards fixes.

= 1.4 =
Major sync improvements: local product updates, safer sale price handling, and automatic SKU selection.
