Skip to content

Commit

Permalink
fix(core): hide discounts from checkout if null (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemoya committed Apr 4, 2024
1 parent 41ebe00 commit ea5a690
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-bears-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bigcommerce/catalyst-core": patch
---

Hide discounts if null
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ export const CheckoutSummary = async ({ cartId, locale }: { cartId: string; loca
<ShippingEstimator checkout={checkout} shippingCountries={shippingCountries} />
</NextIntlClientProvider>

<div className="flex justify-between border-t border-t-gray-200 py-4">
<span className="font-semibold">{t('discounts')}</span>
<span>-{currencyFormatter.format(checkout.cart?.discountedAmount.value || 0)}</span>
</div>
{checkout.cart?.discountedAmount && (
<div className="flex justify-between border-t border-t-gray-200 py-4">
<span className="font-semibold">{t('discounts')}</span>
<span>-{currencyFormatter.format(checkout.cart.discountedAmount.value)}</span>
</div>
)}

{checkout.taxTotal && (
<div className="flex justify-between border-t border-t-gray-200 py-4">
Expand Down

0 comments on commit ea5a690

Please sign in to comment.