Inventory management

JWWD
New Member
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)
L_J_K
Shopify Staff
356 53 65

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.

| API Support @ Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
JWWD
New Member
2 0 0

Thanks @L_J_K 

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