Closed RomanovM closed 1 month ago
nopCommerce version: 4.70
Example You configured RequireOtherProducts - True RequiredProductIds - the list of products AutomaticallyAddRequiredProducts - True Save. After it you disabled RequireOtherProducts - False Nopcommerce will try to add the required products in the shopping cart. It doesn't check the RequireOtherProducts The fix is to add the checking RequireOtherProducts The File ShoppingCartService.cs async Task addRequiredProductsToCartAsync(int qty = 0) { if (!product.RequireOtherProducts) return; //get these required products var requiredProducts = await _productService.GetProductsByIdsAsync(_productService.ParseRequiredProductIds(product)); if (!requiredProducts.Any()) return; var finalRequiredProducts = requiredProducts.GroupBy(p => p.Id) .Select(g => new { Product = g.First(), Count = g.Count() });
Example You configured RequireOtherProducts - True RequiredProductIds - the list of products AutomaticallyAddRequiredProducts - True Save.
After it you disabled RequireOtherProducts - False
Nopcommerce will try to add the required products in the shopping cart. It doesn't check the RequireOtherProducts
The fix is to add the checking RequireOtherProducts The File ShoppingCartService.cs
async Task addRequiredProductsToCartAsync(int qty = 0) { if (!product.RequireOtherProducts) return; //get these required products var requiredProducts = await _productService.GetProductsByIdsAsync(_productService.ParseRequiredProductIds(product)); if (!requiredProducts.Any()) return; var finalRequiredProducts = requiredProducts.GroupBy(p => p.Id) .Select(g => new { Product = g.First(), Count = g.Count() });
Source: https://www.nopcommerce.com/boards/topic/99131/bug-with-adding-required-products
Closed #7206
nopCommerce version: 4.70
Source: https://www.nopcommerce.com/boards/topic/99131/bug-with-adding-required-products