| 开发者 | kitgenix |
|---|---|
| 更新时间 | 2026年9月1日 03:43 |
| 捐献地址: | 去捐款 |
| PHP版本: | 8.1 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv3 or later |
| 版权网址: | 版权信息 |
wp kitgenix-stock-sync
The command class includes status, audit/reconciliation, SKU-level actions, backlog/conflict tooling and formatting helpers for operational use from the command line.
Direct Store-to-Store Data Flow
Stock events and stock-state queries are sent only between the WooCommerce sites configured by the administrator. Kitgenix does not receive the store's inventory feed or act as a remote source of truth.
The shared Kitgenix admin Hub can separately request public plugin metadata from WordPress.org, and the admin stylesheet imports Google Fonts as documented in External Services. Those requests do not contain WooCommerce stock payloads.
Typical Uses
/wp-content/plugins/.wp kitgenix-stock-sync status) – see the developer reference below.Stock drift happens when you update stock on one WooCommerce store but another connected store still shows the old quantity. Left unresolved, it leads to oversells, customer frustration, and messy fulfilment. This plugin prevents stock drift by keeping one authoritative Master store's stock state in sync with all Child stores.
Yes. This plugin hooks WooCommerce product stock APIs and requires WooCommerce to be active.
There is no fixed interval or polling schedule. Stock changes are captured and sent the moment WooCommerce itself changes stock, dispatched asynchronously via Action Scheduler – typically within seconds. A separate recurring health-check ping runs roughly every 15 minutes purely to keep connection status current, not to sync stock.
There is no feed file or CSV import involved in the sync itself. This plugin does not read a feed URL or file – it connects directly, over authenticated REST API calls, to the other WooCommerce store(s) you configure as Master or Child. If you separately import stock into WooCommerce via CSV, that import triggers WooCommerce's own stock-update hooks, which this plugin then syncs like any other stock change.
This plugin uses a single-Master, multiple-Child model: one authoritative Master store can push stock to any number of Child stores, but only one store may act as Master at a time. It does not support pulling stock from multiple independent Master sources into one store.
Install and activate the plugin on the Master store and every Child store, then choose a role for each: one store as Master, all others as Child. On each Child, enter the Master's connection details (HTTPS URL, Master Store ID, and Shared Secret); on the Master, add each Child the same way. Use Test Connection to verify the link, then run Reconcile on the Master to establish stable GIDs and push the initial stock state. See Quick Start above for the full walkthrough.
No. This plugin is designed for a single authoritative Master store and one or more children.
No. It syncs stock state only.
Per SKU: stock quantity, stock status, backorders, and low stock amount.
Sync is automatic. Stock changes are captured the moment WooCommerce itself changes stock (an order, a refund, a CSV import, a REST edit, or a third-party integration) and dispatched asynchronously through Action Scheduler – there's no schedule to configure and no file to upload. Manual tools (Reconcile, Manual SKU Sync) exist for initial setup and troubleshooting, not for day-to-day operation.
Yes. Variations are synced by their own variation SKU, including variations that inherit stock management from their parent product.
External/Affiliate and Grouped products are skipped for stock syncing (these types are not stock-managed in WooCommerce).
Yes. The plugin declares compatibility with WooCommerce's custom order tables (HPOS) feature.
Failed pushes are recorded in the Backlog (with reason, attempt count, and next retry time) and retried automatically using WooCommerce's Action Scheduler with an increasing delay, up to a bounded number of attempts. Once that budget is exhausted, the item is marked for manual attention – it will not retry forever – and can be retried or discarded (with confirmation) from the Logs tab or WP-CLI.
Depends on the configured failure strategy (Configuration tab): fail-open (default, allows checkout), fail-closed (blocks checkout), or use last-known stock (applies a recent cached snapshot if it's fresh enough, otherwise falls back to fail-open). A definitive out-of-stock/insufficient response from a reachable Master always blocks checkout, regardless of this setting.
kitgenix-stock-sync-for-woocommerce)Add SKUs in Configuration → Exclusions. Excluded SKUs are ignored across all sync and tooling paths.
No. Every authoritative item the Master sends carries a monotonically increasing per-product version number. A receiving store records the last version it applied and ignores anything that arrives with an equal or older version – so a delayed event, a retried send, or a replayed request can never overwrite already-current stock, regardless of delivery order. This is in addition to (not instead of) transport-level duplicate detection via each event's unique ID.
WooCommerce 11.0 now restores previously-reduced stock when an order moves to failed (not just cancelled/pending), guarded by WooCommerce's own "was stock actually reduced for this order" flag so it never double-adjusts. This plugin does not reimplement that arithmetic – it reads the resulting WooCommerce stock state after WooCommerce has made the change and synchronises that, so the 11.0 behaviour change is handled automatically with no plugin-specific logic required.
Yes. When Square changes a product's stock on a WooCommerce store, it does so through WooCommerce's own stock-update APIs, which this plugin already listens to – no Square-specific code is needed. If that store is the Master, the change propagates to all Children. If it's a Child, the change is sent to the Master, which rebuilds the authoritative state and fans it out to every other Child (not back to the one that sent it), which is what prevents a feedback loop.
Yes. Use "Rotate Secret" on the Stores tab (this is an admin-UI action; there is no WP-CLI equivalent). The old secret keeps working for a short overlap window (default 24 hours, filterable) so you can update the other store before it expires.
Yes – see the developer reference above for the full command list (wp kitgenix-stock-sync status|audit|reconcile|sku|backlog|conflicts).
Yes. Site Health → Status includes checks for role/connection configuration, connection health, backlog items needing attention, and Action Scheduler availability. Site Health → Info includes a non-secret diagnostic section (role, store ID, counts, timestamps) – shared secrets and store URLs' credentials are never included.
It connects directly between your own WordPress/WooCommerce sites over authenticated REST requests – no third-party sync service is involved. The only outside call is an optional, admin-only lookup of public WordPress.org plugin metadata (install counts, ratings, artwork) for the "Kitgenix hub" screen; see External Services above for full details.
wp kitgenix-stock-sync status, audit, reconcile, sku, backlog, and conflicts.wc_maybe_increase_stock_levels() now also runs on woocommerce_order_status_failed, guarded by WooCommerce's own stock-reduced flag, and Kitgenix Stock Sync correctly synchronises the resulting WooCommerce stock state without reimplementing order-status arithmetic.kitgenix-admin-components.js script providing modals, collapsible cards, copy-to-clipboard controls, live table search, and toast-style save confirmations.kitgenix-admin-tabs.js to drive the new topbar, mobile menu, dropdowns, and dynamic sticky-offset behaviour.