diff --git a/ghost/portal/src/components/common/ProductsSection.js b/ghost/portal/src/components/common/ProductsSection.js index 0836abedf5..f677a3837e 100644 --- a/ghost/portal/src/components/common/ProductsSection.js +++ b/ghost/portal/src/components/common/ProductsSection.js @@ -1,7 +1,7 @@ import React, {useContext, useEffect, useState} from 'react'; import {ReactComponent as LoaderIcon} from '../../images/icons/loader.svg'; import {ReactComponent as CheckmarkIcon} from '../../images/icons/checkmark.svg'; -import {getCurrencySymbol, getPriceString, getStripeAmount, getMemberActivePrice, getProductFromPrice, getFreeTierTitle, getFreeTierDescription, getFreeProduct, getFreeProductBenefits, formatNumber, isCookiesDisabled, hasOnlyFreeProduct, isMemberActivePrice} from '../../utils/helpers'; +import {getCurrencySymbol, getPriceString, getStripeAmount, getMemberActivePrice, getProductFromPrice, getFreeTierTitle, getFreeTierDescription, getFreeProduct, getFreeProductBenefits, formatNumber, isCookiesDisabled, hasOnlyFreeProduct, isMemberActivePrice, hasFreeTrialTier} from '../../utils/helpers'; import AppContext from '../../AppContext'; import calculateDiscount from '../../utils/discount'; @@ -565,13 +565,25 @@ function ProductCardAlternatePrice({price}) { ); } -function ProductCardTrialDays({trialDays}) { - if (trialDays) { - return ( - {trialDays} days free - ); +function ProductCardTrialDays({trialDays, discount}) { + const {site} = useContext(AppContext); + const {selectedInterval} = useContext(ProductsContext); + if (hasFreeTrialTier({site})) { + if (trialDays) { + return ( + {trialDays} days free + ); + } else { + return null; + } } + if (selectedInterval === 'year') { + return ( + {discount}% discount + ); + } + return null; } @@ -599,7 +611,7 @@ function ProductCardPrice({product}) { {formatNumber(getStripeAmount(activePrice.amount))} /{activePrice.interval} - + {(selectedInterval === 'year' ? : '')} @@ -828,11 +840,15 @@ function YearlyDiscount({discount, trialDays}) { } if (freeTrialFlag) { - return ( - <> - {discount}% discount - - ); + if (hasFreeTrialTier({site})) { + return ( + <> + {discount}% discount + + ); + } else { + return null; + } } return (