Out-of-stock UI, variant picker on marketing pages, server-side stock check
- ProductGrid/AddToCartInlineButton/AddToCartButton now show "Ausverkauft" and disable add-to-cart per variant (or product-level with no variants), derived from trackInventory/stock/allowBackorder via isOutOfStock(). - AddToCartButton (todo-cards Hero+Pricing, homepage spotlight) gains the same variant <select> AddToCartInlineButton already had — all three call sites already fetch full product data server-side. - /api/checkout re-validates stock server-side (depth-in-defense, not just the disabled button), rejecting when trackInventory is on, allowBackorder is off, and requested qty exceeds stock. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018PL4zfTY1sXc8x5QS6FatM
This commit is contained in:
@@ -79,6 +79,8 @@ export async function Pricing() {
|
||||
<AddToCartButton
|
||||
label="In den Warenkorb"
|
||||
className="w-full inline-flex items-center justify-center px-6 py-[0.8125rem] rounded-sm bg-brand hover:bg-brand-hover active:scale-[0.97] transition-all font-bold text-body text-text-primary text-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 focus-visible:ring-offset-bg-muted"
|
||||
outOfStock={product.outOfStock}
|
||||
variants={product.variants}
|
||||
/>
|
||||
</div>
|
||||
</Reveal>
|
||||
|
||||
@@ -107,7 +107,9 @@ export async function TodoKartenHero() {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<AddToCartButton label="ToDo-Karten bestellen" />
|
||||
{product && (
|
||||
<AddToCartButton label="ToDo-Karten bestellen" outOfStock={product.outOfStock} variants={product.variants} />
|
||||
)}
|
||||
</div>
|
||||
</Reveal>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user