diff --git a/CHANGELOG.md b/CHANGELOG.md index 793030595d..4ceaeedb45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `getVariantWithLowestPrice` uses inexistent `final_price` property - @cewald (#4091) - Fixed `NOT_ALLOWED_SSR_EXTENSIONS_REGEX` to only match with file extensions having a dot - @haelbichalex (#4100) - Fixed problem with not showing error message when placing an order fails - @qiqqq +- Fixed `cart/isVirtualCart` to return `false` when cart is empty - @haelbichalex(#4182) ### Changed / Improved diff --git a/core/modules/cart/store/getters.ts b/core/modules/cart/store/getters.ts index d881571477..523381646f 100644 --- a/core/modules/cart/store/getters.ts +++ b/core/modules/cart/store/getters.ts @@ -30,7 +30,7 @@ const getters: GetterTree = { getItemsTotalQuantity: ({ cartItems }) => config.cart.minicartCountType === 'items' ? cartItems.length : sumBy(cartItems, p => p.qty), getCoupon: ({ platformTotals }): AppliedCoupon | false => !(platformTotals && platformTotals.hasOwnProperty('coupon_code')) ? false : { code: platformTotals.coupon_code, discount: platformTotals.discount_amount }, - isVirtualCart: ({ cartItems }) => cartItems.every(itm => itm.type_id === 'downloadable' || itm.type_id === 'virtual'), + isVirtualCart: ({ cartItems }) => cartItems.length ? cartItems.every(itm => itm.type_id === 'downloadable' || itm.type_id === 'virtual') : false, canUpdateMethods: (state, getters) => getters.isCartSyncEnabled && getters.isCartConnected, canSyncTotals: (state, getters) => getters.isTotalsSyncEnabled && getters.isCartConnected, isCartEmpty: state => state.cartItems.length === 0,