0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Filtered empty monthly/yearly prices in product

no refs

- in a rare scenario when monthly/yearly price comes as empty object, which happens if the price is missing in DB, this adds a guard to ignore the product than cause an error
This commit is contained in:
Rishabh 2021-06-25 13:08:06 +05:30
parent d8f121e7b0
commit aabb02fc5f

View file

@ -187,6 +187,8 @@ export function getAvailableProducts({site}) {
return products.filter(product => !!product).filter((product) => {
return !!(product.monthlyPrice && product.yearlyPrice);
}).filter((product) => {
return !!(Object.keys(product.monthlyPrice).length > 0 && Object.keys(product.yearlyPrice).length > 0);
}).filter((product) => {
if (portalProducts) {
return portalProducts.includes(product.id);