Fixed product filtering for available products

no refs
This commit is contained in:
Rishabh 2021-06-24 13:55:02 +05:30
parent 7fe377d29a
commit 4fdcd9c4d0

View File

@ -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,