diff --git a/app/todo-cards/components/Pricing.tsx b/app/todo-cards/components/Pricing.tsx index ab4c31c..b0cceda 100644 --- a/app/todo-cards/components/Pricing.tsx +++ b/app/todo-cards/components/Pricing.tsx @@ -3,7 +3,7 @@ import { AddToCartButton } from "../../components/AddToCartButton"; import { Reveal } from "../../components/Reveal"; import { TOTAL_DAYS_DE } from "../../lib/shipping"; import { getProductBySlug } from "../../lib/payload"; -import { formatPrice } from "../../lib/format"; +import { formatPrice, discountPercent } from "../../lib/format"; const bullets = [ "50 ToDo-Karten", @@ -20,6 +20,7 @@ const bullets = [ export async function Pricing() { const product = await getProductBySlug("todo-karten"); if (!product) return null; + const discount = discountPercent(product.price, product.compareAtPrice); return (
@@ -35,6 +36,11 @@ export async function Pricing() { sizes="(min-width: 1024px) 410px, 100vw" className="object-cover transition-transform duration-500 group-hover:scale-105" /> + {discount !== null && ( + + -{discount}% + + )}
@@ -56,6 +62,9 @@ export async function Pricing() {
+ {discount !== null && ( +

{formatPrice(product.compareAtPrice!)}

+ )}

{formatPrice(product.price)}

inkl. MwSt. zzgl. Versand