Try our conversational search powered by Generative AI!

LineItem InStockQuantity always 0 - 10.1.1

Vote:
 

We've upgraded to 10.1.1 and discovered that the InStockQuantity property always returns 0.

Other properties regarding stock status seems also to return 0.

Anyone know why? 

We've built a temporary way around it for now.

#173300
Dec 20, 2016 10:08
Vote:
 

Hi,

Are you using the concrete classes (OrderForm, LineItem, etc), or the new abstraction (IOrderForm, ILineItem etc)?

Do you use the workflows?

/Q

#173301
Dec 20, 2016 10:41
Vote:
 

We extract the LineItems through the CartHelper so we're using the concrete classes. We use the information to structure the content on the page where we display the current content depending which type of items contained therein.

The way we alleviated the problem for now was building an extension which extracts the code from the lineitem and finds the variation to get to know current in stock value.

#173335
Dec 21, 2016 8:51
Vote:
 

If you are using the workflows, then that value should be set in OrderGroupActivityBase.PopulateInventoryInfo. Can you check if the values are correctly set there?

#173341
Dec 21, 2016 11:30
Vote:
 

We're running the CartValidate-workflow. Could it be that it is till running the old workflow instead of VNext?

#173562
Jan 02, 2017 16:43
Vote:
 

That's strange. That function should be run if you are using the "old" workflow. As I said you can download the Workflow project, include it in your solution, build it and debug to see if it is actually called.

#173563
Jan 02, 2017 16:46
Vote:
 

Where do I find the workflow project for download?

I noticed that the WarehouseCode is empty in our case which results in empty result when running [ecf_Inventory_GetInventory]. Could that be the culprit?

#173564
Jan 02, 2017 17:05
Vote:
 

You should be able to use this:

http://world.episerver.com/download/Items/Episerver-Commerce/episerver-commerce-9-tools-and-code-samples/

We will put the new one for Commerce 10 soon. 

#173571
Jan 02, 2017 20:25
Vote:
 

The problem was with WarehouseCode. We were not using it explicitly and in version 9 and previous it seems to have handled empty warehousecodes by setting them to "Default". But in version 10 that seems to be removed. This caused problems with the inventory-numbers but affected also other things dependant on the WarehouseCode.

#173605
Jan 03, 2017 14:01
Vote:
 

The LineItem.WarehouseCode property is now obsoleted - the order system will only work with Shipment.WarehouseCode. However other parts of system were also updated, so it should work just fine - the check for inventories should take the Shipment.WarehouseCode and check it against LineItems in that Shipment. Do you have custom code which does otherwise?

#173606
Jan 03, 2017 14:11
Vote:
 

We had to add entries to the cart with this method in CartHelper:

public virtual LineItem AddEntry(Entry entry, Decimal quantity, bool fixedQuantity, string warehouseCode, params CartHelper[] helpersToRemove)

Earlier we used this:

public virtual LineItem AddEntry(Entry entry, Decimal quantity, bool fixedQuantity, params CartHelper[] helpersToRemove)


This solved our problem and quantity is evaluated in a correct way.

#173789
Jan 10, 2017 8:36
Vote:
 

@Tobias, you have upgraded to 10, but still use legacy Cart and LineItem objects?

#174465
Edited, Jan 26, 2017 16:09
Vote:
 
<p>It's perfectly fine to use legacy Cart (or even CartHelper) and LineItem in Commerce 10. I can imagine many customers upgrade so they can use the new features/bug fixes, especially in the new promotion system. But yes, it's highly recommended to move to the new abstraction APIs ASAP.</p>
#174639
Feb 01, 2017 10:56
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.