Woo Stock Sync from CSV v1.4.13
Changes
= 1.4.13 =
- Fixed: Severe MySQL CPU overload on large stores caused by overlapping stock syncs. The old "is running" guard was a 30-minute transient that expired mid-sync, so every cron tick could launch another full sync on top of one already running, stacking up long-running SKU-lookup queries. Replaced with a real single-run lock (MySQL GET_LOCK, with an atomic wp_options fallback) that spans the entire sync and is shared by the scheduled, manual, and any other entry points. The lock auto-releases if the process dies, so it can never get stuck.
- Added: Wall-clock runtime cap (default 20 minutes, filterable via
wssc_max_runtime) replacingset_time_limit(0), so a single run can no longer execute for hours. A time-capped run logs a warning and finishes the remaining rows on the next run (missing-SKU zero/private actions are skipped on capped runs to avoid acting on an incomplete view). - Performance: The per-batch SKU lookup now resolves SKUs through the indexed
skucolumn of the HPOSwc_product_meta_lookuptable (falling back to the legacy postmeta query only when that table is absent), eliminating the unindexedwp_postmeta.meta_value IN (...)scan and its triple self-join. - Performance: The store-wide
wc_delete_product_transients()cache flush now runs once per sync instead of once per 100-row batch, and thewc_product_meta_lookupexistence check is detected once per request instead of on every product update.
= 1.4.12 =
- Fixed: When the same SKU was used by more than one product (e.g. multilingual duplicates from WPML/Polylang), only one product was updated per sync and the others kept their old stock. Sync now updates every product carrying the SKU, in both the CSV-matched batch path and the "Set missing SKUs to 0" path.
- Changed: Internal —
wssc_privatized_productsnow stores a list of product IDs per SKU. Old single-ID entries are still read for backward compatibility.
= 1.4.11 =
- Added: Debug page (Stock Sync → Debug) showing per-SKU values across the CSV, postmeta, HPOS lookup table, and the WooCommerce product API. Includes per-product "Clear caches" and "Force update to CSV value" actions.
= 1.4.10 =
- Fixed: Sync skipped products when
_stockpostmeta and the HPOSwc_product_meta_lookuptable had drifted out of sync, leaving the admin display unchanged. Sync now compares against both sources and repairs drifted rows automatically.
= 1.4.8 =
- Version bump
= 1.4.7 =
- Fixed: Cron jobs not rescheduled after plugin auto-update (watchdog and sync stopped)
- Fixed: after_install not detecting plugin during auto-updates/bulk updates
- Added: Boot-time cron recovery on every page load as safety net
= 1.1.3 =
- Fixed: JavaScript error when viewing log details (duration.toFixed)
= 1.1.2 =
- Fixed: License now persists when plugin is deactivated/reactivated
- Fixed: License now persists when plugin is updated
- License deactivation only happens when user explicitly clicks "Deactivate License"
= 1.1.1 =
- Added manual "Check for Updates" button in License page
- Added one-click "Update" button when new version available
- Improved update UI with version info display
= 1.2.9 =
- Refactored: DRY - Cron intervals now defined once and shared across plugin
- Refactored: DRY - Stats array defined once via get_default_stats() method
- Fixed: Deprecated current_time('timestamp') replaced with time()
- Fixed: Missing wssc_watchdog_last_check option in uninstall cleanup
- Fixed: sanitize_sql_orderby() now handles false return value safely
- Fixed: Watchdog docblock now correctly says 'hourly' not '4 hours'
- Removed: Unused get_products_by_skus() dead code
- Code quality improvements from senior engineer review
Installation
- Download
woo-stock-sync-from-csv-1.4.13.zip - Go to WordPress Admin → Plugins → Add New → Upload Plugin
- Upload the zip file and activate
Requirements
- WordPress 5.8+
- WooCommerce 5.0+
- PHP 7.4+