From 4fdcd9c4d0f9ca154dd032188c4208828b7d05c7 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Thu, 24 Jun 2021 13:55:02 +0530 Subject: [PATCH] Fixed product filtering for available products no refs --- ghost/portal/src/utils/helpers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ghost/portal/src/utils/helpers.js b/ghost/portal/src/utils/helpers.js index cdfeb00a77..be0753d9d3 100644 --- a/ghost/portal/src/utils/helpers.js +++ b/ghost/portal/src/utils/helpers.js @@ -179,12 +179,14 @@ export function getAvailableProducts({site}) { } return products.filter(product => !!product).filter((product) => { + return !!(product.monthlyPrice && product.yearlyPrice); + }).filter((product) => { if (portalProducts) { return portalProducts.includes(product.id); } return true; }).sort((productA, productB) => { - return productA?.monthlyPrice?.amount - productB?.monthlyPrice.amount; + return productA?.monthlyPrice?.amount - productB?.monthlyPrice?.amount; }).map((product) => { product.monthlyPrice = { ...product.monthlyPrice,