ShelfPin

How to show stock by location on a Shopify product page

Your customers keep asking the same question before they buy: can I get this today, near me?

Shopify knows the answer — inventory is tracked per location in your admin. Getting that answer onto the product page is the part that turns out to be harder than it sounds. This page covers what the platform gives you for free, why the obvious do-it-yourself approach hits a wall, and what your real options are. If the free option covers you, use it — it's said plainly below.

First: Shopify already does some of this

Shopify has a built-in pickup availability feature. If you turn on local pickup for a location, most modern themes will show a line under the buy button along the lines of "Pickup available at Main Street, usually ready in 24 hours", with a link listing your other pickup locations.

It's free, it's native, and it needs no app. If what you want is to tell customers they can collect an order, stop here and turn on local pickup. Online Store → Settings → or per location under Settings → Locations → Local pickup.

Where it stops short:

Why you can't just write it in Liquid

The natural instinct is to edit the theme. It's worth understanding exactly where that runs out, because the limit isn't your skill — it's what the storefront is allowed to know.

Liquid gives you a variant's total inventory across every location:

{{ product.selected_or_first_available_variant.inventory_quantity }}
<!-- 8 -->

Eight, in total, somewhere. Not three at Main Street and five in the warehouse. There is no per-location breakdown on that object, because the storefront is deliberately not given one.

The one exception is store_availabilities, which is what themes use to render the pickup line — and it is scoped to locations with local pickup turned on. So it inherits the same limitation: shops without pickup enabled aren't in the data at all, and what you get is availability rather than counts.

Per-location quantities live behind the Admin API, which needs an authenticated server-side request. A theme can't make one — it has no credentials, and you would not want it to, because anything the theme holds is readable by anyone who views source.

That's the whole reason this needs an app rather than a snippet. Not complexity — authentication. Somewhere off your storefront has to hold a token and answer the question on the page's behalf.

The caching problem underneath it

There's a second reason even a server-rendered answer misbehaves, and it catches people who solve the first one.

Product pages get cached hard, which is why storefronts are fast. Inventory changes every time someone buys something. Bake stock counts into the cached HTML and you will eventually show a shopper "3 left at Main Street" on a page rendered an hour ago, when the real answer is zero. The shopper drives over to find nothing there, which is worse than never having told them.

Anything trustworthy has to fetch stock after the page loads, and refetch when the shopper switches size or colour — because stock is per variant, and a page that keeps showing the Medium numbers while someone reads about the Large is quietly lying.

So your options are

1 Native pickup availability

Free, no app. Right answer if you offer click-and-collect and don't need quantities. Turn on local pickup and you're finished.

2 A custom app

A private app of your own, holding an Admin API token, answering a request from your theme. Entirely doable, and correct if you have unusual rules or already run your own infrastructure. You're now maintaining a service — including its hosting, its API version upgrades, and its behaviour at 2am on a Friday.

3 A public app

Someone else maintains that service.

Worth checking before you install any of them:

Where ShelfPin fits

Available now

Airport KioskOnly 3 left
Main Street5 in stock
WestportOut of stock

ShelfPin is option three, built narrowly: it shows stock at each of your locations under the buy button, updates as shoppers change variant, hides warehouses and addressless locations automatically, and has read-only access — it cannot change your inventory, edit products, or contact your customers. It collects no customer data and sets no cookies on your storefront.

The first 100 stores keep it free permanently.

More about ShelfPin →