Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
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.
Solved! Go to the solution
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
To learn more visit the Shopify Help Center or the Community Blog.
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
To learn more visit the Shopify Help Center or the Community Blog.
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