cart
This commit is contained in:
@@ -175,7 +175,7 @@ export class CartValidationService {
|
||||
const foodMap = await this.getFoodsInCartWithCategories(cart);
|
||||
|
||||
for (const item of cart.items) {
|
||||
const product = foodMap.get(item.productId);
|
||||
const product = foodMap.get(item.variantId);
|
||||
if (!product) continue;
|
||||
|
||||
const matchesCategory = hasCategoryRestriction && product.category && categoryRestriction.includes(product.category.id);
|
||||
@@ -190,7 +190,7 @@ export class CartValidationService {
|
||||
* Get products in cart with categories
|
||||
*/
|
||||
async getFoodsInCartWithCategories(cart: Cart): Promise<Map<string, Product>> {
|
||||
const productIds = cart.items.map(item => item.productId);
|
||||
const productIds = cart.items.map(item => item.variantId);
|
||||
if (productIds.length === 0) return new Map();
|
||||
|
||||
const products = await this.em.find(Product, { id: { $in: productIds } }, { populate: ['category'] });
|
||||
|
||||
Reference in New Issue
Block a user