creative designer

Most people that need to know the total stock value are already likely to be using a third party Inventory Management System, ERP (or similar). If you want to know what your total stock value is you can grab that info via the API - let's look how.

Giant disclaimer first - this post talks about pasting in JavaScript into your browser console whilst within your Admin. There's so many reasons why this could be a bad idea. If you're not sure what the code does, do not run it. A sneaky person could try and trick you into pasting code in the debug console and do all sorts of nasty things (like deleting customer, products, etc). I should probably be viewed with the same level of distrust if we're strangers, so test this in a dev or testing account first.

The Logic:

The logic is pretty simple:

  • Grab all the products in the store
  • Loop over the variants
  • Get the price for each variant
  • Times the price by the inventory amount
  • Add that amount to the global amount.

^ Once we're at the end of the loop we'll have the master total.

Important note: A product that you don't track inventory on will be excluded from the results.

The Code:

Paste this into the debug console. Run, wait, success (hopefully)!

Assuming it all worked you should see something like this:



Like to work with me?

Let's talk