The updatedAtFrom and updatedAtTwo filters are currently applied to the StockRepositoryContract used for calculating inventory amounts for periodic inventory synchronizations, causing the Wayfair plugin to send the inventory amount(s) only for the Warehouse(s) that changed.
If only one warehouse had a change for the item, the item will go out of stock until the next change in stock!
The Wayfair plugin should be sending an up-to-date calculation of ALL inventory for the item, in ALL Warehouses where it appears.
The timestamp filters should only be used to detect if the stock amounts for the Variation has experienced any changes.
This PR introduces a hasInventoryChanged helper function which uses its own StockRepositoryContract to check if there is at least one stock change for the Variation. It is invoked only if either (or both) of the timestamp filters are set. If the filters are set and no stock changes are present, inventory calculation for the Variation in view is cancelled, and the Variation is not included in the periodic inventory synchronization.
Fixes https://github.com/wayfair-contribs/plentymarkets-plugin/issues/194
The
updatedAtFrom
andupdatedAtTwo
filters are currently applied to theStockRepositoryContract
used for calculating inventory amounts for periodic inventory synchronizations, causing the Wayfair plugin to send the inventory amount(s) only for the Warehouse(s) that changed. If only one warehouse had a change for the item, the item will go out of stock until the next change in stock!The Wayfair plugin should be sending an up-to-date calculation of ALL inventory for the item, in ALL Warehouses where it appears. The timestamp filters should only be used to detect if the stock amounts for the Variation has experienced any changes.
This PR introduces a
hasInventoryChanged
helper function which uses its ownStockRepositoryContract
to check if there is at least one stock change for the Variation. It is invoked only if either (or both) of the timestamp filters are set. If the filters are set and no stock changes are present, inventory calculation for the Variation in view is cancelled, and the Variation is not included in the periodic inventory synchronization.