I want to add my own units to a product, use my own unit ids to be able to import them from the erp system.
I have tried this:
Dynamicweb.eCommerce.Stocks.StockUnit unit = new Dynamicweb.eCommerce.Stocks.StockUnit("");
unit.UnitID = dwProduct.Unit.UnitCode;
unit.ProductID = product.ID;
unit.VariantID = "";
product.Units.Add(unit);
unit.Save(unit.ProductID, unit.VariantID, unit.UnitID);
product.DefaultUnitID = unit.UnitID;
Best regards,
Per
(By the way, this question has nothing to do with earlier questions from me about units, it's another solution and customer).