Inventory Sync Overview
Inventory synchronisation is bidirectional. Stock levels can flow in both directions depending on your store configuration — though you should typically choose one authoritative system to avoid conflicts.
Store Configuration for Inventory
In your Caz Woo Store record, under Inventory Sync Settings:
- Sync Stock to WooCommerce — When ERPNext stock changes, update WooCommerce product stock quantities.
- Sync Stock from WooCommerce — When WooCommerce stock changes, create a Stock Reconciliation in ERPNext.
- Stock Sync Threshold — Minimum stock quantity change required to trigger a sync. Set to 0 to sync on any change. Higher values reduce API load.
ERPNext → WooCommerce
When a Stock Ledger Entry is submitted in ERPNext (from any transaction — purchase receipt, stock transfer, stock reconciliation), WooSync:
- Checks if the affected Item has a Caz Woo Item Mapping for this store
- Calculates the new total available quantity from the configured warehouse
- Applies the threshold check
- Updates the WooCommerce product’s
stock_quantityvia the Products API - Handles both simple products and variations
WooCommerce → ERPNext
When WooCommerce stock changes (e.g., a manual stock adjustment or a sale that reduces stock), WooSync:
- Receives the product update event via webhook
- Compares the WooCommerce stock quantity to the current ERPNext quantity
- If the difference exceeds the threshold, creates a Stock Reconciliation document in ERPNext for the configured warehouse
Avoiding Loops
WooSync includes deduplication logic to prevent sync loops. When ERPNext creates a Stock Reconciliation from WooCommerce data, it marks the operation as system-initiated so the resulting Stock Ledger Entry does not trigger another push back to WooCommerce.
Bulk Stock Push
To push all current ERPNext stock levels to WooCommerce at once (useful for initial setup), use the Sync All Stock action on the Caz Woo Store record. This queues a stock sync for every mapped item.