Developer forum

Forum » Ecommerce - Standard features » Change handling of stockstate

Change handling of stockstate

Lars Larsen
Lars Larsen
Reply

Hi

On one of our projects we want to record the stock (in the stockmatrix) when an order changes orderstate and not when the order is created. As far as I can see this is not possible by standard functionality. Would it then be an option to hook up on an order notification (API) when the orderstate changes and then update the stock. Then I need to disable the standard updating of stock. Should I do that by sending a stocklocationid (in the querystring when adding product to cart) that corresponds to a dummy stocklocation? Any ideas are appreciated. Thanks.


Replies

 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

How about adding back same stock using order complete notification?

 
Lars Larsen
Lars Larsen
Reply

Hi Shiwanka

Thanks for your suggestion smiley

 
Lars Larsen
Lars Larsen
Reply

Hi

How can I update the stock level on one stock location for a product? There are a lot of code in the API regarding stock-, units- and locations, and I can't figure out what code to use.

 
Nicolai Pedersen
Reply

Use the StockUnitService. Dynamicweb.Ecommerce.Services.StockUnitService

 
Lars Larsen
Lars Larsen
Reply

Hi Nicolai

But StockUnitService is internal and located in Dynamicweb.Ecommerce.Stocks in v9.9.1 that I use.

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

Hi Lars,

You can use Dynamicweb.Ecommerce.Services.StockService - GetStockUnit and SaveStockUnit methods.

Best regards,
Morten

Votes for this answer: 1
 
Lars Larsen
Lars Larsen
Reply

Hi Morten

Thanks smiley

 

You must be logged in to post in the forum