REST API: Fastest Way to Delete All Shopify Products

I will share with you my tried and true recipe, to save you and others the pain of thinking about it too deeply.

  1. use GraphQL to download your entire Shopify store inventory in one go, Bulk style

  2. for that query, ask for the details you’d be wanting to update, or not, up to you. Regardless, you get every ID of every product

Note that since you want to update, and now that you have a Shopify ID, note that you absolutely need to be able to use this information to match your external data. Likely using SKU or barcode for that. Hence my point above. GQL is super for asking for just such info. Note that smart people download the JSONL file, reverse it, and then quickly build up a data structure in memory, that serves as your Shopify dictionary per se.

So now that you have Shopify at your disposal, note that this has not taken too long either. Fantastic.

  1. Get your external data in some kind of data structure now too. Since you probably set a key (Shopify product ID) to point to an array of variant IDs (SKU or barcode), you can now quickly look up an entire Shopify product in the external data for data, and prepare for an update. Once you have that data structure set (an entire Shopify product is now ready for an update, you make that one API call).

You will encounter external data that was not touched. Perhaps that is NEW data you need to consider. Deal with it. You may have Shopify variants not found too. Again, deal with that. In the end, you will be keeping your Shopify inventory as fresh as you can, and not running any kind of out-of-control algorithm. This is all nice, neat, and tight. Easy to customize too.