feat(shipping): move delivery-time settings to Payload, polish product/cart CTAs
The delivery-time range (handling + transit days) was a hardcoded HANDLING_DAYS/TRANSIT_DAYS_DE pair in lib/shipping.ts — changing it needed a code deploy. Now sourced from Payload's new Shipping Settings collection via getShippingSettings(), threaded down as a prop to the few Client Components (Cart/Checkout/VersandModal) that can't fetch it themselves, with the old code constants removed. Also: the delivery-time note is now shown on every purchase CTA (shop grid, home spotlight, ToDo-Karten hero + pricing panel), not just one of them — required next to each buy button per Art. 246a §1 Abs.1 Nr.8 EGBGB, not just somewhere reachable via a link. Checkout's sidebar was missing the "ab 39€ kostenlos" note Cart already had; that's fixed too, and both now show the delivery-time range on its own line instead of crammed onto the shipping-cost line. Related smaller fixes bundled in since they touch the same files: price/delivery-time spacing tightened into its own group, the redundant "Sichere Zahlung" note under Cart's checkout button (already shown via the trustBadges list right below) replaced with "Sichere SSL-Verschlüsselung" to match Checkout, and ToDo-Karten's pricing panel no longer shows a premature payment-security note at the add-to-cart step.
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
import Link from "next/link";
|
||||
import {
|
||||
SHIPPING_COST,
|
||||
FREE_SHIPPING_THRESHOLD,
|
||||
HANDLING_DAYS,
|
||||
TRANSIT_DAYS_DE,
|
||||
TOTAL_DAYS_DE,
|
||||
} from "../../lib/shipping";
|
||||
import { SHIPPING_COST, FREE_SHIPPING_THRESHOLD } from "../../lib/shipping";
|
||||
import { formatPrice } from "../../lib/format";
|
||||
import type { ShippingSettings } from "../../lib/payload";
|
||||
|
||||
// Single source of truth for both the full /versand page and the cart's
|
||||
// quick-reference VersandModal — same section ids/titles/copy either way,
|
||||
@@ -51,20 +46,27 @@ function Section({
|
||||
);
|
||||
}
|
||||
|
||||
export function VersandSections({ withAnchors = false }: { withAnchors?: boolean }) {
|
||||
export function VersandSections({
|
||||
withAnchors = false,
|
||||
shipping,
|
||||
}: {
|
||||
withAnchors?: boolean;
|
||||
shipping: ShippingSettings;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-col gap-10 items-start w-full">
|
||||
<Section id="lieferzeiten" title="Lieferzeiten" withAnchor={withAnchors}>
|
||||
<p>
|
||||
Nach Zahlungseingang bereiten wir deine Bestellung in der Regel innerhalb von{" "}
|
||||
{HANDLING_DAYS.min}–{HANDLING_DAYS.max} Werktagen zum Versand vor. Die Versanddauer
|
||||
innerhalb Deutschlands beträgt anschließend zusätzlich {TRANSIT_DAYS_DE.min}–
|
||||
{TRANSIT_DAYS_DE.max} Werktage.
|
||||
{shipping.handlingDays.min}–{shipping.handlingDays.max} Werktagen zum Versand vor. Die
|
||||
Versanddauer innerhalb Deutschlands beträgt anschließend zusätzlich{" "}
|
||||
{shipping.transitDays.min}–{shipping.transitDays.max} Werktage.
|
||||
</p>
|
||||
<p>
|
||||
Damit ist deine Bestellung in der Regel nach {TOTAL_DAYS_DE.min}–{TOTAL_DAYS_DE.max}{" "}
|
||||
Werktagen bei dir, sofern auf der jeweiligen Produktseite nichts anderes angegeben ist.
|
||||
Als Werktage gelten Montag bis Freitag, ausgenommen gesetzliche Feiertage.
|
||||
Damit ist deine Bestellung in der Regel nach {shipping.totalDays.min}–
|
||||
{shipping.totalDays.max} Werktagen bei dir, sofern auf der jeweiligen Produktseite nichts
|
||||
anderes angegeben ist. Als Werktage gelten Montag bis Freitag, ausgenommen gesetzliche
|
||||
Feiertage.
|
||||
</p>
|
||||
</Section>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Reveal } from "../components/Reveal";
|
||||
import { Footer } from "../components/Footer";
|
||||
import { VersandSections } from "./components/VersandSections";
|
||||
import { VersandTOC } from "./components/VersandTOC";
|
||||
import { getShippingSettings } from "../lib/payload";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Versand",
|
||||
@@ -12,7 +13,9 @@ export const metadata: Metadata = {
|
||||
alternates: { canonical: "/versand" },
|
||||
};
|
||||
|
||||
export default function VersandPage() {
|
||||
export default async function VersandPage() {
|
||||
const shipping = await getShippingSettings();
|
||||
|
||||
return (
|
||||
<>
|
||||
<main className="flex flex-col flex-1 bg-bg-base">
|
||||
@@ -38,7 +41,7 @@ export default function VersandPage() {
|
||||
<VersandTOC />
|
||||
</div>
|
||||
<div className="w-full lg:flex-1 max-w-[45rem]">
|
||||
<VersandSections withAnchors />
|
||||
<VersandSections withAnchors shipping={shipping} />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user