public static void AddAttributes(this PriceCalculationContext context, IEnumerable <OrganizedShoppingCartItem> cart) { Guard.NotNull(context, nameof(context)); var item = cart?.FirstOrDefault(x => x.Item.ProductId == context.Product.Id); if (item?.Item != null) { context.AddAttributes(item.Item); if (item.Item.Product.ProductType == ProductType.BundledProduct && item.Item.Product.BundlePerItemPricing) { item.ChildItems.Each(x => context.AddAttributes(x.Item)); } } }
public static void AddAttributes(this PriceCalculationContext context, ShoppingCartItem item) { Guard.NotNull(context, nameof(context)); if (item != null) { context.AddAttributes(item.AttributeSelection, item.ProductId, item.BundleItemId); } }