feat(email): per-variant paid/unpaid body templates in settings

The previous single body field could not distinguish 'use the default' from
'save the pre-filled default', so the first settings save locked the hint in
as a custom override for ALL orders — the paid/unpaid default logic never ran.

Give each payment state its own editable body field (emailBodyHtmlDePaid /
emailBodyHtmlEnPaid) with its own empty-fallback. A body submitted unchanged
from its built-in default is stored as empty, so 'use default' survives saves
and future default updates propagate.
This commit is contained in:
Gerhard Scheikl
2026-08-24 16:35:09 +02:00
parent ff5c435bd4
commit 602b336a94
5 changed files with 76 additions and 32 deletions
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "ShopSettings" ADD COLUMN "emailBodyHtmlDePaid" TEXT NOT NULL DEFAULT '';
ALTER TABLE "ShopSettings" ADD COLUMN "emailBodyHtmlEnPaid" TEXT NOT NULL DEFAULT '';
+4
View File
@@ -94,10 +94,14 @@ model ShopSettings {
smtpReplyTo String @default("")
// Email templates (HTML, with {{var}} placeholders). Empty = use defaults.
// The Body fields are the UNPAID (outstanding) variant; the *Paid fields are
// sent for orders that are already settled (paid/refunded/voided).
emailSubjectDe String @default("")
emailBodyHtmlDe String @default("")
emailSubjectEn String @default("")
emailBodyHtmlEn String @default("")
emailBodyHtmlDePaid String @default("")
emailBodyHtmlEnPaid String @default("")
// Automations (webhook-driven, as a fallback to Shopify Flow which only
// exposes custom-app actions on Plus stores).