IProductPricingService.GetPrices trying to determine with option was selected

Breck Caine asked on October 28, 2021 20:08

I am using IProductPricingService.GetPrices to return custom prices and that is working fine. I need to add the product option price as well, but I am having trouble determining that.

My option is for a warranty. YES (you get charged) and NO you don't. I loop through IEnumerable SKUInfo options and I can see both options, but I need to know which option they selected on add to cart, so I know if I should apply the option charge.

Is there something in IEnumerable SKUInfo that lets me know which one was selected?

Nevermind... I now see the different SKU and SKUPrice seem to be what I need.

Recent Answers


Danny Winbourne answered on November 1, 2021 11:08

You could write the "with/without warranty" value to the CartItemCustomData object when adding to the basket, and you should then be able to read this in your custom code.

 ShoppingCartInfoProvider.SetShoppingCartInfo(cart);
 var parameters = new ShoppingCartItemParameters(productSKUID, quantity);
 var cartItem = ShoppingCartInfoProvider.SetShoppingCartItem(cart, parameters);
 cartItem.CartItemCustomData["WithWarranty"] = withWarrantyValue;
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.