I’m working on creating an intermediate app to sync all relevant information from an ERP to Shopify, where the ERP is leading in terms of most product information, variants, inventory levels, and locations.
While I’m constantly running into issues because of limitations in Shopify, I’m currently kind of stuck with inventoryBulkToggleActivation or inventoryActivate, and the inventory levels themselves. The current tenant I’m working with has ~100k variants, with ~20 locations, this is up to 2M Inventory Items.
Right now I’m running a script to call inventoryBulkToggleActivation to activate all locations for all inventory items that have not been activated yet, because otherwise I can’t send inventory levels. This is honestly a weird setup and I’d expect inventory tracking to be automatically enabled when I tell the system there’s inventory at this locations, but it is what it is. Unfortunately for a smaller subset (probably 60k variants and up to 6 locations as a test) and this has been taking way too long already. For each variants I do a call with up to 6 locations, and at the time of writing this process has been running for over 40 minutes, how can I speed this up?
The second part that I’m worried about is the actual inventory level sync. When we want to sync all inventory item levels this will take ~5minutes for 120k records (limited locations for testing), which when scaled up will be way too slow. This system uses a locations bulk operation query, and executes this for each locations, this already is fairly slow.
The main problem is that we have to retrieve everything and calculate the new levels. I’ve implemented a partial update that can run during the day, which is much faster, but will fall back to the above if it detects a larger set of modified levels. Generally speaking the partial updates will be in the range of 0 to 100 modified variants every update, which we want to schedule every 2~5 minutes (shorter is better).
How should I approach these syncs? The calls I found existing right now seem to be too slow overall to use a “pull from system X and pull from system Y and send the new state back to X”. Currently we plan on syncing the full inventory levels every night, and every few minutes we send the deltas for variants with inventory level changes in the past ~10 minutes, which will only send the deltas using inventoryAdjustQuantities.