Skip to content

Zero kit counts at other locations and sweep items that stop or start being kits - #10

Merged
mpge merged 2 commits into
mainfrom
fix/kit-stock-sweep
Nov 30, 2026
Merged

mpge merged 2 commits into
mainfrom
fix/kit-stock-sweep

Conversation

@mpge

@mpge mpge commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Two problems with kits on Inventoros 2.7 and newer.

Old counts at other locations. A kit was only set at the primary (or "all stock") location. Any other mapped location kept what was pushed there before, such as the kit's own stock or the count from when it was primary, so Shopify offered too many. A kit is now set to 0 at every other mapped location. The count sent is remembered per location, so the scheduled sync notices a changed primary or a newly mapped location and sends only the locations that changed. Unchanged counts are still never sent again by the sync. Any other reason for a push (stock hook, component list change, manual resync) sends every location as before.

Items that stop or start being kits. A kit changed to another type kept its kit count until its stock next moved. The scheduled sync now pushes its own stock once and forgets the kit count. Variants of a kit are pushed as 0, since core refuses to sell a kit by variant, once when their product becomes a kit.

Locations where the variant is not stocked. Shopify refuses a whole inventory call when one item in it is not stocked at the location. The zeros that only clear another location are therefore sent in their own calls, after every real count. A refused call is repeated row by row; a row refused alone is logged as a warning and skipped, and counts as sent so the scheduled sync does not repeat it. A refused real count, a zero at the primary or "all stock" location, and every other failure (rate limit, network, credentials, frozen store) still fail the push as before.

Tests: 192 (172 before), full suite passes on SQLite.

mpge added 2 commits November 29, 2026 23:05
… being kits

A kit was only set at the primary location, so another mapped location kept whatever was pushed there before. Every other mapped location now gets 0, the count sent is remembered per location, and the scheduled sync sends only the locations that changed.

The scheduled sync also pushes a kit changed to another type its own stock once, and variants of a kit are pushed as 0.
Shopify refuses a whole inventory call when one item is not stocked at a location, so a single kit zero could hold back every stock push of the connection. The zeros that only clear another location now go in their own calls after the real counts. A refused call is repeated row by row, and a row refused alone is logged as a warning and skipped. Every other failure is thrown as before.
@mpge
mpge merged commit 0caa7c0 into main Nov 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant