From 2e8db93ab6e5018c110dfd6bc6b2b6ce96361ed2 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Tue, 18 May 2021 20:26:11 +0530 Subject: [PATCH] Filtered selected prices in Portal settings no refs Filters active prices in Portal settings to only contain the selected prices by site owner in new monthly/yearly price id settings, ignoring all other prices for now. --- core/server/services/members/middleware.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/server/services/members/middleware.js b/core/server/services/members/middleware.js index 9cfb2c8f7c..26a71772ef 100644 --- a/core/server/services/members/middleware.js +++ b/core/server/services/members/middleware.js @@ -89,9 +89,14 @@ const getDefaultProductPrices = async function () { const activePrices = prices.filter((d) => { return !!d.active; }); + const monthlyPriceId = settingsCache.get('members_monthly_price_id'); + const yearlyPriceId = settingsCache.get('members_yearly_price_id'); + const filteredPrices = activePrices.filter((d) => { + return [monthlyPriceId, yearlyPriceId].includes(d.id); + }); return { product: productData, - prices: activePrices + prices: filteredPrices }; } return {};