The module ships four transactional templates and overrides the standard Magento order confirmation email to surface pre-order context. All are wired through etc/email_templates.xml so the four templates can be overridden in admin under Marketing → Communications → Email Templates like any other Magento email.
The four templates
| Template ID | When it fires | Recipient |
|---|---|---|
byte8_preorder_email_completion_ready_template | Pre-order marked ready and has an outstanding balance — drained by byte8_preorder_send_ready_notifications cron | Customer |
byte8_preorder_email_availability_template | Stock arrives — legacy availability notification (can also be bulk-resent from the admin grid) | Customer |
byte8_preorder_email_completion_template | Vault capture or completion order succeeds — pre-order moves to complete | Customer |
byte8_preorder_vault_capture_failed_email_template | Vault capture exhausts retries | Customer |
Order confirmation enhancements (no template override needed)
When an order contains pre-order items, the standard order_new email is enhanced by layout/template overrides under view/frontend/:
- Orange callout above the items table — "This order contains pre-order items" with the pre-order reference, original total, deposit paid, and Balance Due When Ready.
- Per-item indicator — pre-order line items get a Pre-Order pill below the SKU plus a small panel showing full price / deposit / balance / expected available date.
Non-pre-order orders render the stock confirmation email unchanged. Implementation: view/frontend/layout/sales_email_order_items.xml, templates/email/order/preorder_summary.phtml, templates/email/items/order/default.phtml.
Triggering rules
Completion-ready email — the tokenised flow
Fires from Cron/SendReadyNotifications.php (every minute), draining every pre-order in ready state with an outstanding balance and no successful send yet.
The body contains a tokenised completion link — /preorder/order/complete/preorder_id/{id}/token/{48-char-token} — built against the storefront base URL. A logged-out customer can pay the balance through this link via hash_equals token validation; no account login required. The token is stored on byte8_preorder.completion_token, cleared after successful balance payment.
The cron retries failed sends with attempt-count backoff (capped at 5). Investigate stuck rows with:
SELECT entity_id, increment_id, status, total_remaining_amount,
ready_notification_attempts, ready_notification_last_error
FROM byte8_preorder
WHERE status = 'ready'
AND total_remaining_amount > 0
AND ready_notification_sent_at IS NULL;
Re-running markPreorderReady (admin action, mass action, or CLI) resets the counter and re-queues the row.
See Flag-and-drain cron for the full mechanic.
Availability email
Legacy notification, fires when stock first arrives and updateAvailability runs. The completion-ready email is the recommended channel for partial-deposit pre-orders since it carries the actionable payment link; availability stays for full-payment pre-orders and as a bulk-resend tool from the admin grid (Send Availability Notification mass action).
Completion email
Fires when a pre-order moves to complete, regardless of whether the trigger was vault capture, the tokenised completion order, or the auto-complete cron. Always sent.
Vault capture failed email
Fires only when:
- Vault capture is enabled in config.
- The cron retry counter reaches
max_attempts. - The fallback hasn't already been sent for this pre-order (no double-send if a re-attempt also fails).
The email body links the customer to My pre-orders → Pay balance so they can complete payment manually.
Customising
In admin, go to Marketing → Communications → Email Templates → Add New Template, choose one of the Pre-Order templates as the source, edit, save, and configure it back under Stores → Configuration → Byte8 → Pre-Order → (relevant section) as the active template.
Template variables exposed:
| Variable | Available in |
|---|---|
{{var preorder.increment_id}} | All four |
{{var preorder.total_remaining_amount}} | Completion-ready, availability, vault-failed |
{{var preorder.total_paid_amount}} | All four |
{{var customer_name}} | All four |
{{var completion_url}} | Completion-ready (tokenised, single-use) |
{{var formatted_remaining_amount}} | Completion-ready (pre-formatted in the order currency) |
{{var order}} | All four (full sales order object) |
{{var item_names}} / {{var item_skus}} | Availability |
{{var complete_url}} | Vault-failed (customer-account deep link) |
Sender / reply-to
All four emails use the standard Magento sales sender by default (Stores → Configuration → Sales → Sales Emails → General Settings). To use a different sender for pre-order specifically, set it under Stores → Configuration → Byte8 → Pre-Order → Email Settings.
Performance note — email is deferred
Mark Ready does not send the completion-ready email inline. The action returns in ~5ms; the cron sends within 60s. This keeps bulk paths fast:
| Path | What's synchronous | What's deferred |
|---|---|---|
| Per-row Mark Ready in grid / order-view tab | Status flip + token | |
| Mass Mark Ready (N rows) | N status flips | N emails |
| MSI stock-arrival plugin (M SKUs × K pre-orders each) | M × K status flips | M × K emails |
byte8:preorder:scan-stock CLI | Same as above | Same |
The drainer caps total email latency at the cron tick (60s) while keeping the trigger path constant-time.
Localisation
The default templates ship with English copy. German translation lives in i18n/de_DE.csv. Add other locales by creating the corresponding CSV file in your store-view's locale directory.
Related
- Cron jobs — the
SendReadyNotificationsdrainer. - Vault capture — when the failure email fires.
- Mass actions — bulk-resend availability from the admin grid.