diff --git a/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailModal.tsx b/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailModal.tsx index 5b6ee9908a..fc397798e7 100644 --- a/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailModal.tsx +++ b/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailModal.tsx @@ -257,6 +257,7 @@ const TierDetailModalContent: React.FC<{tier?: Tier}> = ({tier}) => { title='Monthly price' valueInCents={formState.monthly_price || ''} hideTitle + onBlur={event => ((event.target.value === '') ? updateForm(state => ({...state, monthly_price: 0})) : null)} onChange={price => updateForm(state => ({...state, monthly_price: price}))} onKeyDown={() => clearError('monthly_price')} /> @@ -268,6 +269,7 @@ const TierDetailModalContent: React.FC<{tier?: Tier}> = ({tier}) => { title='Yearly price' valueInCents={formState.yearly_price || ''} hideTitle + onBlur={event => ((event.target.value === '') ? updateForm(state => ({...state, yearly_price: 0})) : null)} onChange={price => updateForm(state => ({...state, yearly_price: price}))} onKeyDown={() => clearError('yearly_price')} /> diff --git a/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailPreview.tsx b/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailPreview.tsx index f68d03dd91..ae5c115087 100644 --- a/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailPreview.tsx +++ b/apps/admin-x-settings/src/components/settings/membership/tiers/TierDetailPreview.tsx @@ -76,8 +76,10 @@ const TierDetailPreview: React.FC = ({tier, isFreeTier}) const currencySymbol = currency ? getSymbol(currency) : '$'; const benefits = tier?.benefits || []; - const monthlyPrice = currencyToDecimal(tier?.monthly_price ?? 500); - const yearlyPrice = currencyToDecimal(tier?.yearly_price ?? 5000); + const defaultMonthlyPrice = isFreeTier ? 0 : 500; + const defaultYearlyPrice = isFreeTier ? 0 : 5000; + const monthlyPrice = currencyToDecimal(tier?.monthly_price ?? defaultMonthlyPrice); + const yearlyPrice = currencyToDecimal(tier?.yearly_price ?? defaultYearlyPrice); const yearlyDiscount = tier?.monthly_price && tier?.yearly_price ? Math.ceil(((monthlyPrice * 12 - yearlyPrice) / (monthlyPrice * 12)) * 100) : 0; @@ -96,7 +98,7 @@ const TierDetailPreview: React.FC = ({tier, isFreeTier})

{name || (isFreeTier ? 'Free' : 'Bronze')}

-
+
{currencySymbol} {showingYearly ? numberWithCommas(yearlyPrice) : numberWithCommas(monthlyPrice)} {!isFreeTier && /{showingYearly ? 'year' : 'month'}}