Share via


How to Update Multiple SKUs

You can use the catalog system to update multiple SKUs in a single operation. You specify a collection of items to update and use one of the SaveSkus methods to save changes. You use this method to save any changes made to the inventory catalog.

To update multiple SKUs

  1. Get the set of SKUs to update.

  2. Set the property to update.

  3. Use one of the SaveSkus methods on the InventoryCatalog object to update the SKUs in the inventory catalog.

Example

This example describes how to update a collection of SKUs. It first gets the collection and sets the value of the property Memo for each SKU in the collection. It then sets a different value for the first SKU and saves the changes to the collection.

public static void BulkUpdate(InventoryContext context, string catalogName)
{
    // Get an inventory catalog and all the SKUs in it.
    InventoryCatalog inventoryCatalog = context.GetInventoryCatalog(catalogName);
    InventorySkuCollection skus = inventoryCatalog.GetSkus();
    
    // Set the Memo property for all SKUs in the collection.
    foreach (InventorySku sku in skus)
        sku.Memo = "Test memo";
    
    // Make the first one different.
    skus[0].Memo = "New memo"'
   
    // Save the collection.
    inventoryCatalog.SaveSkus(skus);
}

See Also

Other Resources

How to Manage Bulk Updates and Deletions