2

I am able to add products and associated with Category programmatically. Now I need to add the Inventory sets to its associated products.

Do I need to add the Inventory sets while adding the Sellabale items? Or do I need to create the Inventory sets after Sellable items are created and just associate the Sellable items with Inventory set?

1

You can create the inventory set separately and associate it with the sellable items. These are the steps I follow:

  1. Create an InventorySet and associate the inventory set with the catalog (You can use the IAssociateCatalogToInventorySetPipeline pipeline).
  2. Create an InventoryInformation record. Associate the InventoryInformation record with the InventorySet by creating a "InventorySetToInventoryInformation" relation using the ICreateRelationshipPipeline pipeline.
  3. Retrieve the SellableItem and add an InventoryComponent with an inventoryassociation that points to the InventoryInformation entity:

    InventoryAssociations.Add(new InventoryAssociation { InventoryInformation = new EntityReference(id), InventorySet = new EntityReference(inventorySet.Id) }

  • 1
    any possible to add some sample code here? – Hussain Aug 17 '18 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.