Hi there,
I had a weird issue where integrated products wouldn't return stock from locations until I saved the product in the backend first. I managed to track it down to this code in DefaultStockLevelPrrovider:
public override double? FindStockLevel(Product product, string unitId, StockLocation stockLocation)
{
bool foundDefault = false;
double valueDefault = 0.0d;
double result = 0.0d;
if (product.UnitCount > 0)
{
This code checks product.UnitCount before it looks up the stock. In my case, the UnitCount(er) was zero in the database. When you save the product in the backend, the value is changed to 1, fixing the problem. To test my theory, I updated the counter in the database directly, cleared the product service cache and lo and behold, the stock was there.
What's the purpose of this UnitCount field? I couldn't find much on it other than "Gets or sets the unit counting" which didn't help. Is this field still relevant and if so, what value do I set it to in integration? Or can I just change it to 1 on all my products? In my database, the value is either 0 or 1, despite having lots of units, variants and stock units.
Thanks!
Imar