From c4c2c6747a359ceffe129f3169d12fea02027301 Mon Sep 17 00:00:00 2001 From: SDLyu Date: Tue, 5 May 2020 23:29:49 +0800 Subject: [PATCH] Fix options undefined bug --- core/modules/cart/helpers/getProductConfiguration.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/modules/cart/helpers/getProductConfiguration.ts b/core/modules/cart/helpers/getProductConfiguration.ts index 901a9edd55..df5a9b8f97 100644 --- a/core/modules/cart/helpers/getProductConfiguration.ts +++ b/core/modules/cart/helpers/getProductConfiguration.ts @@ -6,8 +6,8 @@ const ATTRIBUTES = ['color', 'size'] const getProductConfiguration = (product: CartItem): ProductConfiguration => { const options = getProductOptions(product) - const getAttributesFields = (attributeCode) => - options[attributeCode].find(c => c.id === parseInt(product[attributeCode])) + const getAttributesFields = (attributeCode) => + (options[attributeCode] || []).find(c => c.id === parseInt(product[attributeCode])) if (!options) { return null