Developer forum

Forum » Ecommerce - Standard features » Stock Status text based on available stock (considering reserved stock/Available amount)

Stock Status text based on available stock (considering reserved stock/Available amount)

Lara Arsénio
Reply

Hello.

I am having trouble showing the stock status according to the Reserved Stock, in product List / Detail pages when adding products to cart.

Scenario: 

The Settings for Stock are defined in Settings > Ecommerce > Orders > Stock States . The Stock is set to 3 levels

0 - Out of Stock

<=10 - Low   

>=11 -  Available

A product exists with 12 available items. 3 items are added to cart. Having now 9 items, I need to Show the label "Low", which is not happening. 

My idea is to get all the possible Stock states of a product and use logic update them on the fly, while the products are being added to cart.

What API method should I Use for that?

This one seems to retrieve only the current State, not all possible, is that correct?

https://doc.dynamicweb.com/api/html/f38d64a6-cc4b-7724-157a-b0240115c51e.htm

Thanks in advance

 

 

 

 

 


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer

Does GetStockStatuses on StockStatus give you what you need? (https://doc.dynamicweb.com/api/html/859886e1-47eb-a0c9-c176-1f9638eb74c4.htm) Rate and Definition give you the values specified in the backend (rate is the number, definition something like > or < etc.).

I guess the only problem is that you need to parse the proper values / thresholds yourself.

Imar

Votes for this answer: 1
 
Lara Arsénio
Reply

I was implementing the Dynamicweb.Ecommerce.Stocks.StockGroup.GetStockGroups() method  but havent seen these you suggested.

The key here is that the first returns all Statuses of All StockGroups, and the Dynamicweb.Ecommerce.Stocks.StockStatus.GetStockStatuses() requires the statusGroupId as parameter. I think ill go for the second choice because it requires less iteration

 

 

You must be logged in to post in the forum