=== AutoSync WC Connect ===
Contributors: AutoSync
Tags: woocommerce, rest-api, inventory, sync, stock
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.2
Stable tag: 1.0.5
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

The official connector between your WooCommerce store and AutoSync. Keeps the stock and prices of your tire and wheel products up to date automatically.

== Description ==

AutoSync WC Connect is the official link between your WooCommerce store and **AutoSync**, the inventory service that keeps your tire and wheel listings current.

Once your store is connected, AutoSync looks after your stock levels and prices for you. On a regular sync schedule, AutoSync gathers the latest availability and pricing and applies it to the matching products in your store — so your listings stay reliably up to date without spreadsheets, CSV imports, or manual edits.

You stay in control of what's managed. On the plugin's settings page you choose which of your product categories hold tires and which hold wheels. Only products in those categories are synced — everything else in your store is left untouched.

= Before you start =

This plugin is a companion to AutoSync and is only useful if you have an AutoSync account. To learn more or sign up, visit https://autosynccorp.com/.

You'll also need WooCommerce active on your store. Setup takes only a few minutes — see the Installation tab.

== External services ==

The plugin makes no outbound network requests of its own. Instead, it registers authenticated REST API endpoints that AutoSync's servers connect to, using the WooCommerce REST API keys you generate and enter into AutoSync. Through those endpoints AutoSync:

* reads product and inventory data for the categories you configure — product/variation ID, SKU, name, brand, regular price, and stock quantity;
* writes stock-quantity and regular-price updates back to those products.

Only product and inventory data is shared with AutoSync. The plugin does not transmit customer data, order data, or any personally identifiable information.

== Installation ==

1. Install and activate WooCommerce.
2. Upload and activate this plugin.
3. Go to **WordPress admin → Settings → AutoSync WC Connect**.
4. **Tire categories** — start typing a category name and pick from the suggestions; selected categories appear as removable chips. Subcategories show as breadcrumb paths (e.g. "Tires › All-Season › Heavy-Duty") so same-named categories under different parents are unambiguous.
5. **Wheel categories** — same for wheels.
6. **Save Changes**.

Categories can be added or removed at any time. The next sync run picks up the new configuration automatically — no AutoSync-side change needed.

== Frequently Asked Questions ==

= Do I need an AutoSync account? =

Yes. This plugin connects your store to AutoSync and only works together with an AutoSync account. Visit https://autosynccorp.com/ to get started.

= Which products get synced? =

Only products in the categories you select on the **Settings → AutoSync WC Connect** page — the ones you mark as tire categories and wheel categories. Anything outside those categories is never touched.

= Will my customer or order data be shared? =

No. Only product and inventory data (such as stock quantity and price) for the categories you choose is shared with AutoSync. Customer information and orders are never transmitted.

= Nothing is syncing, or my product list looks empty =

Make sure you've selected at least one category for the product type in question on the settings page. Until a tire category is chosen, tire data stays empty; the same applies to wheels.

= My store uses a different brand plugin =

By default the plugin reads brands from the standard `product_brand` taxonomy used by most brand plugins. If your store organizes brands differently, just reach out to AutoSync and we'll get it set up for you.

== Changelog ==

= 1.0.5 =
* Security: the `/inventory` write endpoint now performs a per-product capability check (matching WooCommerce's own product controller) before changing any stock or price, so per-object permission rules are honored rather than bypassed by the single endpoint-level check.
* Hardening: `per_page`/`page` request bounds are now validated against the schema and clamped server-side.
* Performance: the settings option is registered with `autoload` disabled, so it is no longer loaded on every front-end request.
* Compliance: added an "External services" section to the readme disclosing the AutoSync connection and the product/inventory data shared with it.
* Internal: store the "last synced" marker under the plugin's own meta key prefix instead of WooCommerce's reserved `_wc_admin_` namespace.

= 1.0.4 =
* Settings page: category pickers now use a searchable token field (WordPress `FormTokenField`) with breadcrumb labels, replacing the checkbox checklist.
* Security: split the REST permission callback into read- and write-specific gates so the `/inventory` endpoint requires `edit_others_products` rather than just `read_private_products`.
* Internationalization: wrapped all user-facing strings (settings page, meta box, REST error messages, warning header) in gettext calls so the plugin is fully translatable via translate.wordpress.org.
* Internal: switched to PHP 8.1 first-class callable syntax for hook/route registrations.

= 1.0.3 =
* Internationalization: added `Text Domain` header and matching gettext call so the plugin is translatable via translate.wordpress.org.

= 1.0.2 =
* Initial public release.
