get Price for ProductVariantCollection ProductVariantItem
Hi.
How can i get the price on each ProductVariantItem in a ProductVariantCollection?
I know i can get a IProductSnapshot from a variant by doing VendrApi.Instance.GetProduct(productReference: IPublishedContent.Key.ToString(), productVariantReference: ProductVariantItem.Content.Key.ToString(), languageIsoCode: culture).CalculatePrice();
But is there a way to get the price with only using the ProductVariantCollection?
foreach (ProductVariantItem variant in ProductVariantCollection)
{
var price = variant.???
}
You'll need to use the GetProduct method you mention. The ProductVariantCollection is an Umbraco property editor related model but to get a price from Vendr, it needs converting to a Vendr product snapshot first.
We might be able to create some extension methods to simplify this, but we don't currently have those so you'll either need to create them or go the long way round using the GetProduct method.
get Price for ProductVariantCollection ProductVariantItem
Hi.
How can i get the price on each ProductVariantItem in a ProductVariantCollection?
I know i can get a IProductSnapshot from a variant by doing
VendrApi.Instance.GetProduct(productReference: IPublishedContent.Key.ToString(), productVariantReference: ProductVariantItem.Content.Key.ToString(), languageIsoCode: culture).CalculatePrice();
But is there a way to get the price with only using the ProductVariantCollection?
Hey Bo,
You'll need to use the
GetProduct
method you mention. TheProductVariantCollection
is an Umbraco property editor related model but to get a price from Vendr, it needs converting to a Vendr product snapshot first.We might be able to create some extension methods to simplify this, but we don't currently have those so you'll either need to create them or go the long way round using the
GetProduct
method.Matt
For now i made a simple method, thanks :)
is working on a reply...