Mark already-purchased items on the wishlist instead of auto-removing

A customer often wishlists something specifically to buy it again (gifts, repurchases) — silently removing it after purchase would defeat that. /konto/merkliste now shows a dimmed image + "Gekauft am [date]" badge instead, derived read-only from the customer's own orders (cancelled/returned orders excluded). Removal stays manual.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Marco
2026-07-31 13:51:10 +00:00
parent 8a4170a1e6
commit 230b8ebaad
4 changed files with 104 additions and 20 deletions
+23
View File
@@ -2313,6 +2313,29 @@ features requires the matching `CompanySettings` toggle to actually be
switched on before it shows up anywhere in the frontend — if a feature
"isn't showing," check that first.
## Wishlist "already purchased" marker (2026-07-31)
Decided against auto-removing a wishlist item once the customer buys it —
a customer often wishlists something specifically *to* buy it again
(gifts for multiple people, anything they'd repurchase), so silently
removing it right when they'd next want it defeats the point. Instead,
`/konto/merkliste` (`MerklisteGrid.tsx`) marks it: dimmed image + a
"Gekauft am [date]" badge (replaces the "Ausverkauft" badge when both
would apply — already-owning it matters more than a restock notice).
Removal stays entirely manual, same `WishlistButton` as always.
- **`WishlistItem.purchasedAt`** (`app/lib/customerAuth.ts`) — never
persisted on the backend's `wishlist-items` collection (its `update`
access is hard-disabled by design); derived fresh on every
`getWishlist()` call by cross-referencing the customer's own orders
(`getPurchasedVariantMap()`), matched on the exact `(product, variant)`
pair a wishlist row represents. Excludes `cancelled`/`returned` orders
— an aborted or refunded order doesn't mean the customer actually owns
the item.
- Flows through `useWishlist.ts`'s existing item shape/cache/broadcast
mechanism unchanged — this is purely an added read-only field, not a
new toggle or a second collection.
## DHL checkout integrations (2026-07-31)
Three checkout-facing pieces added, each invisible unless the tenant's