=== Countervane – Inventory Sync for Square ===
Contributors: srikrishnaduduku
Tags: square, inventory, stock sync, point of sale, woocommerce
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Keep stock in sync between Square POS and WooCommerce – no SKUs required. Sell in your shop and online without overselling.

== Description ==

You sell in your shop with Square and online with WooCommerce. When something sells in one place, the other place should know – otherwise you sell the same item twice.

Countervane keeps the two in sync, and it works **even if your products have no SKUs**.

= What it does =

* **Connect with Square** in one click (secure OAuth – no API keys to copy).
* **Link products without SKUs.** Countervane matches by SKU when you have them, by name when you don't, and lets you search and link anything by hand.
* **Online orders update Square straight away.** Orders, cancellations, refunds and manual stock edits in WooCommerce are sent to Square within seconds – no waiting for a schedule.
* **Square sales update WooCommerce** when you click "Sync stock now".
* **Imports new Square items** into WooCommerce as drafts or published products, with price and stock. A product with the same name is linked instead of duplicated.
* **Fills in missing prices** from Square (or always copies them – your choice). Sale prices are never touched.
* **Handles items deleted in Square:** the WooCommerce product is set to Out of stock and unlinked, so you never sell something you no longer have.
* **Plain-English sync history** – every change and every skipped item, with the reason.
* **Built for real catalogs:** paged, searchable product table; large first imports run in batches so they never time out.
* **Safe by design:** never double-counts a sale (idempotent updates), retries when Square is unreachable, never wipes stock if Square returns an empty catalog, and warns you if another plugin syncs the same products.

= Countervane Pro =

The free plugin is complete and works on its own. **Countervane Pro** adds:

* **Automatic sync every 5 minutes**, so sales in your Square shop reach your website without clicking anything.
* **Items with sizes and colours** imported from Square as one WooCommerce product with options.

= Who it is for =

Shops that sell in person with Square and online with WooCommerce: clothing, sarees, gifts, bookshops, cafés selling retail – especially catalogs built in Square without SKUs.

== Installation ==

1. Install and activate WooCommerce.
2. Install and activate Countervane (Plugins → Add New → search "Countervane").
3. Go to **WooCommerce → Countervane** and click **Connect with Square**. Approve access on Square's page.
4. Choose your Square location and click **Save settings**.
5. Click **Load Square catalog** to see how your Square items match your WooCommerce products. Link anything that is not matched yet.
6. Click **Sync stock now**.

== Frequently Asked Questions ==

= Do my products need SKUs? =

No. Countervane links products by SKU when they exist, by exact name for new items, and you can link anything else by hand with the product search box. Links are remembered, so you only do this once.

= Which way does stock flow? =

Both ways. WooCommerce sales, cancellations, refunds and manual edits are sent to Square right away. Square sales come to WooCommerce when you click "Sync stock now" (or automatically every 5 minutes with Countervane Pro).

= Can I use it together with the official "WooCommerce Square" plugin? =

Yes, for card payments. Don't let both plugins sync the same products – Countervane shows a warning if it finds products that are also marked "Sync with Square" there.

= What happens if Square is down? =

Changes are kept and retried automatically. Each change is sent with a unique key, so a retry is never counted twice.

= Does Countervane change my prices? =

By default it only fills in a price when the WooCommerce product has none. You can choose "always copy" or "never change" in the settings. Sale prices are never changed.

= Which Square location is used? =

The one you choose in the settings. Support for combining several locations is planned.

= What data leaves my site? =

Only what is needed to talk to Square – see "External services" below. Nothing is sent to the plugin author.

== External services ==

This plugin connects to **Square** (Block, Inc.) to read your item catalog and stock levels, and to send stock changes when items sell in WooCommerce.

* What is sent: your Square access token (in the request header), Square catalog object IDs, your Square location ID, and stock quantity changes. When you click "Connect with Square", your browser is sent to Square's sign-in page.
* When: when you load the catalog, run a sync, when stock of a linked product changes in WooCommerce, and when the connection is renewed.
* Square terms of service: https://squareup.com/legal/general/ua
* Square privacy notice: https://squareup.com/legal/general/privacy

**Connection relay page.** After you approve access on Square, Square sends your browser to a small static page hosted on GitHub Pages, which immediately forwards it back to your own site's admin page. The page receives a one-time authorization code and your site's admin address in the browser's address bar; it stores nothing and sends nothing anywhere else. The code is useless without a secret that never leaves your site (PKCE).

* GitHub terms of service: https://docs.github.com/site-policy/github-terms/github-terms-of-service
* GitHub privacy statement: https://docs.github.com/site-policy/privacy-policies/github-general-privacy-statement

== Screenshots ==

1. Connect with Square in one click, pick your location and choose how prices and new items are handled.
2. Catalog table: see every Square item, its WooCommerce match and both stock levels. Filter by "Not linked" or "Stock differs".
3. Link products without SKUs using the product search box.
4. Sync history explains every change in plain English.

== Changelog ==

= 1.0.0 =
* First public release: Connect with Square, linking without SKUs, real-time WooCommerce → Square stock updates, manual Square → WooCommerce sync, new-item import, price fill-in, deleted-item handling, sync history.

== Upgrade Notice ==

= 1.0.0 =
First public release.
