The Shopify Point of Sale Integer Overflow that is breaking the inventory count of 318M products

UPDATE: They’ve implemented the fix API-side. All ends well!

I was doing work for a friend on Shopify when he told me his POS station wouldn’t update the inventory of new items he sold in-store.
He tried a few things, such as deleting the product and recreating it, changing its SKU and barcode, etc.

Then, he called me. He had exchanged a few emails with the Shopify support team and couldn’t get a straight answer.

That seemed odd, so I investigated.

Turns out their database uses unsigned INTs whereas their POS stations use signed INTs.

The POS sends out negative IDs instead of positive IDs when submitting a purchase. The API can’t find the given ID since it doesn’t exist.

In my tests, my variant_id was 2466028673, which is over the signed INT limit of 2147483647. When the POS system sends out the purchase call to the API, it sends out -1828938623 as the variant_id.

Judging by my variant_id, this has been a problem for at least 318 000 000 products so far.

Apparently, they will be releasing a new version of their POS soon — but won’t fix the API to cast back those negative IDs back into their positive form. That’s bad.

So, if you’re wondering why your inventory is not updating, this is probably why.