Developer forum

Forum » Swift » Issue getting the stock unit name from stock matrix

Issue getting the stock unit name from stock matrix

Daniel Voicu
Daniel Voicu
Reply

Hello,

I'm trying to get the Stock Unit Name value from stock matrix using the API because I understood there is no other way to get it now. This is my code to get the other values : ExpectedDelivery and Stock. Using this I can get the UnitId but I have no other ways of getting the name. How should I get the UnitName the product.UnitOptions returns 0 so I can't filter it out of that collection?

 

var stocks = stockService.GetStockUnits(product.Id,product.VariantId);

DateTime stockMatrixEpectedDeliveryRaw = DateTime.Now; 
string stockMatrixExpectedDelivery = "";
double stockMatrixStock = 0;
string stockMatrixUnit = "";
string stockMatrixUnitName = "";

foreach (var stock in stocks)
{
  stockMatrixExpectedDelivery = stock.ExpectedDelivery.ToShortDateString();
  stockMatrixStock = stock.StockQuantity;
  stockMatrixUnit = stock.UnitId;
  
  stockMatrixEpectedDeliveryRaw = stock.ExpectedDelivery > DateTime.Now ? stock.ExpectedDelivery : DateTime.Now;
  
}

 

I looked for other API ways of getting the name but none worked.


Replies

 
Daniel Voicu
Daniel Voicu
Reply

Hello,

Is there a way to get the Unit Name value when using Stock Matrix in the current Swift implementation ?

 

You must be logged in to post in the forum