Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Inventory management

Inventory management

JWWD
Shopify Partner
4 0 0

Hi all,

 

I'm wondering if it is possible to update a product's inventory / stock levels from a Shopify page without adding to the cart / checking out?

In short, I have a page with multiple select lists populated by all products in a specific collection, when selecting a product from the collection I am hoping to have the inventory / stock for that specific product reduce by one. My first thought was to use AJAX and make an API call to /admin/api/2021-10/inventory_levels/adjust.json but I'm unsure if this is possible or a good solution for security reasons.


Hoping there is a quick and easy solution or a better way to manage this. 

Replies 2 (2)

Luke_K
Shopify Staff
402 66 102

Hey @JWWD 

 

One thought was that we wouldn't recommend calling the Admin API with an AJAX call via the front end as it's not secure - you'd expose your access credentials. You'd need to to call the Admin API from a backend server/middleware for those inventory levels.

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
JWWD
Shopify Partner
4 0 0

Thanks @Luke_K 

Are you able to link me to an example of this solution?