Inventory management

JWWD
Visitor
2 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
Shopify Staff
402 66 95

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
Visitor
2 0 0

Thanks @Luke_K 

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