Skip to main content
added 14 characters in body
Source Link

I am trying to get the product variants from a SellableItem but I can't seem to be able to find the Variant item.

Below are the steps that I am doing currently

1A) Get sellable item

var sellableItemId = "myid"
SellableItem item = container.SellableItems.Where(x => x.IdProductId == sellableItemId ))..FirstOrDefault()

return item.ItemVariations;

1B) This returns a list of variantIds.

"57042066|57042067|57042068|57042069|57042070"

2A) I tried using similar code below to retrieve the variant item, but it is not able to find anything.

var variantId = "57042066";
var variant = container.SellableItems.Where(x => x.IdProductId == variantId));

I am trying to get the product variants from a SellableItem but I can't seem to be able to find the Variant item.

Below are the steps that I am doing currently

1A) Get sellable item

var sellableItemId = "myid"
SellableItem item = container.SellableItems.Where(x => x.Id == sellableItemId ))..FirstOrDefault()

return item.ItemVariations;

1B) This returns a list of variantIds.

"57042066|57042067|57042068|57042069|57042070"

2A) I tried using similar code below to retrieve the variant item, but it is not able to find anything.

var variantId = "57042066";
var variant = container.SellableItems.Where(x => x.Id == variantId));

I am trying to get the product variants from a SellableItem but I can't seem to be able to find the Variant item.

Below are the steps that I am doing currently

1A) Get sellable item

var sellableItemId = "myid"
SellableItem item = container.SellableItems.Where(x => x.ProductId == sellableItemId ))..FirstOrDefault()

return item.ItemVariations;

1B) This returns a list of variantIds.

"57042066|57042067|57042068|57042069|57042070"

2A) I tried using similar code below to retrieve the variant item, but it is not able to find anything.

var variantId = "57042066";
var variant = container.SellableItems.Where(x => x.ProductId == variantId));
Source Link

Sitecore Commerce Sellable item variants

I am trying to get the product variants from a SellableItem but I can't seem to be able to find the Variant item.

Below are the steps that I am doing currently

1A) Get sellable item

var sellableItemId = "myid"
SellableItem item = container.SellableItems.Where(x => x.Id == sellableItemId ))..FirstOrDefault()

return item.ItemVariations;

1B) This returns a list of variantIds.

"57042066|57042067|57042068|57042069|57042070"

2A) I tried using similar code below to retrieve the variant item, but it is not able to find anything.

var variantId = "57042066";
var variant = container.SellableItems.Where(x => x.Id == variantId));