Adding Inventory to Product Page

Solved
Highlighted
Tourist
12 1 1

We have several physical locations of our stores. We would like to let our customers know how many products are in stock at which location. For example:

Mason Jar

 

123 Main St - 4 in stock

456 Other St - 2 in stock

 

I have created a private app and tested the InventoryItems and Location APIs with Postman and I am able to make requests, but I am not sure how to integrate this with my theme on Shopify.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
51 10 5

This is an accepted solution.

Hi there, 

 

In order to have inventory information available on your online store (i.e. within your theme), this data needs to exist within Liquid (Shopify's language that acts as the data layer for your online store). Since you are not able to get inventory information on a per location basis within liquid, one option to display this data within your theme you could employ metafields to populate the inventory values from your private application, which you can then access from within your theme. 

 

Here is an article that outlines how to use metafields within your theme: 

- https://www.shopify.ca/partners/blog/110057030-using-metafields-in-your-shopify-theme

 

Additionally, here is our official documentation regarding metafields in Liquid and REST API. 

https://shopify.dev/docs/liquid/reference/objects/metafield

https://shopify.dev/docs/admin-api/rest/reference/metafield

 

 

0 Likes
Highlighted
Shopify Partner
152 4 26

If you are looking for a more extensive solution you can also check out my app which lets you display inventory information per location on the product pafge and more :)

 

https://apps.shopify.com/product-inventory-information

 

 

0 Likes