From d5a059cd6cf294f07ed710315f90707092e4f40b Mon Sep 17 00:00:00 2001 From: zubair-ce07 Date: Mon, 8 Apr 2024 18:53:00 +1000 Subject: [PATCH] fix: updated code to fix failing test --- src/payment/data/reducers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/payment/data/reducers.js b/src/payment/data/reducers.js index e83618d20..847233eec 100644 --- a/src/payment/data/reducers.js +++ b/src/payment/data/reducers.js @@ -36,7 +36,9 @@ const basket = (state = basketInitialState, action = null) => { }; case BASKET_DATA_RECEIVED: - localStorage.setItem('sku', action.payload.products[0].sku); + if (action.payload.products && action.payload.products.length > 0) { + localStorage.setItem('sku', action.payload.products[0].sku); + } return { ...state, ...action.payload }; case BASKET_PROCESSING: return {