=== STIV Stock Sync for KeyCRM ===
Contributors: stepanwp
Tags: woocommerce stock, keycrm stock, stock synchronization
Requires at least: 5.5
Tested up to: 7.0
WC requires at least: 8.7
WC tested up to: 10.8
Stable tag: 1.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Synchronize product stock levels between WooCommerce and KeyCRM. This plugin is not affiliated with or endorsed by KeyCRM.

== Description ==

This plugin allows you to synchronize product stock levels between WooCommerce and KeyCRM.
Stock synchronization is automatically performed **via webhook**. When stock levels are changed in KeyCRM, a webhook is sent to WooCommerce, and product stock data is updated automatically.

To automatically transfer stock data **from WooCommerce to KeyCRM**, you must configure a cron job.
The cron job should periodically call a special URL on your site, which sends current stock data to KeyCRM in automatic mode.

**[UA]**
Плагін дозволяє синхронізувати залишки товарів між WooCommerce та KeyCRM.
Синхронізація залишків виконується автоматично **через webhook**. При зміні залишків у KeyCRM вебхук надсилається на сайт WooCommerce, після чого дані про залишки товарів оновлюються автоматично.

Для автоматичної передачі даних **із сайту WooCommerce в KeyCRM** необхідно налаштувати cron.
Cron-завдання повинно періодично викликати спеціальний URL на вашому сайті, який відправляє актуальні залишки товарів у KeyCRM.

== Screenshots ==
1. Settings: Synchronization from KeyCRM to site
2. Settings: Synchronization from site to KeyCRM

== Installation ==

= Automatic Installation =

1. Log in to your WordPress dashboard
2. Go to Plugins → Add New
3. Search for "STIV Stock Sync for KeyCRM"
4. Click "Install Now"
5. Click "Activate"

= Manual Installation =

1. Download the plugin
2. Unzip the archive
3. Upload the `stiv-stock-sync-for-keycrm` folder to `/wp-content/plugins/`
4. Go to Plugins in the WordPress dashboard
5. Activate the plugin

== Frequently Asked Questions ==

= Можна відправляти залишки з Keycrm на сайт WooCommerce?
Так, відбувається через вебхук. Налаштування вебхука в системі KeyCRM.app

= Можна відправляти залишки з сайту в Keycrm?
Так, можна вручну викликати функцію або через CRON JOBS

= Як програмно відправити залишки з WooCommerce в KeyCRM?
Якщо потрібно кодом відправити залишки в KeyCRM, можна використати функцію:
`sstkcrm_send_stock_to_keycrm()`

= Якщо виникли питання/проблеми? =
З будь-яких технічних питань звертайтеся через [форум підтримки](https://wordpress.org/support/plugin/stiv-stock-sync-for-keycrm/)
або пишіть напряму: stepan-1@ukr.net

== External services ==

This plugin connects to the **KeyCRM API** (`https://openapi.keycrm.app/v1`) to synchronize product stock levels.

= What data is sent and when =

* **From KeyCRM to WooCommerce (webhook mode):** KeyCRM sends stock data (SKU, quantity, offer ID) to your site via webhook. No data is sent from your site in this direction.
* **From WooCommerce to KeyCRM (cron/manual sync mode):** Your site sends product stock data (SKU and quantity) to the KeyCRM API endpoint `/offers/stocks` when a sync is triggered manually or by a cron job. No personally identifiable information is transmitted — only stock/inventory data.
* **Connectivity check:** On the plugin settings page the API key is validated by making a request to the KeyCRM API. Only the API key (entered by the site administrator) is sent at this point.

= Third-party service information =

* **Service:** KeyCRM — a CRM platform for e-commerce businesses.
* **API base URL:** [https://openapi.keycrm.app/v1](https://openapi.keycrm.app/v1)
* **Terms of Service:** [https://ua.keycrm.app/terms-of-use](https://ua.keycrm.app/terms-of-use)
* **Privacy Policy:** [https://ua.keycrm.app/privacy-policy](https://ua.keycrm.app/privacy-policy)

This plugin is not affiliated with or endorsed by KeyCRM. Use of the KeyCRM service is subject to their terms and privacy policy.

== Changelog ==

= 1.0.0 =
* Initial release
