Bundles and gift vouchers: codes booked later, confirm without paying #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bundles-vouchers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The studio wants to sell bundles (e.g. 3 massages + a bottle of oil for one price) and gift vouchers that are paid now and booked later. A voucher for one service is just a bundle with one part. There are no customer accounts, so the buyer gets a code: whoever has it books the included sessions without paying again, until it expires.
How it works
ABCD-2345, no 0/O/1/I), shown on the result page and in the confirmation email.Also fixed (was broken on
main)PocketBase 0.23 can't store an empty number; it reads back as 0. So:
items.trackStockflag. The migration turns it on for existing products, so nothing that sells today changes. To make a product unlimited, clear its stock field in the admin.orders.total,orders.stripePaymentIntentIdandorder_lines.pricewere required, and PocketBase treats 0 / '' as blank. They are now optional: a code-paid booking costs 0 and has no payment.Tested
main(with existing orders and products) and fresh install (pb_schema.jsonimport, which has a passes ↔ orders ↔ baskets relation loop) both work.svelte-check: 0 errors in both apps. The 18 + 3 warnings were already there before this change.Not tested: a real Stripe payment in the browser (stripe-mock can't run the Payment Element), real email sending, mobile layouts.
Deploying
The migration runs on the next PocketBase start. Back up
pb_datafirst. Then set up bundles under Services & products. Check which products should be unlimited: they keep enforcing their stock number until it's cleared.🤖 Generated with Claude Code
https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW