Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Buy label, print label and packing slip on the fulfillment card

Damian Legawiec978abb849477
diff --git a/CLAUDE.md b/CLAUDE.md
index 58733236de..17e4a820df 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -22,7 +22,7 @@ Active plans (6.0 target, work pending):
- `6.0-typed-stock-movements.md` — Replace generic StockMovement with typed kinds + concrete FKs
- `6.0-normalize-state-to-status.md` — Rename state → status on Payment, Shipment, InventoryUnit, ReturnAuthorization, GiftCard
- `6.0-delivery-profiles.md` — **Implemented in PR #14404 (2026-08-09).** `Spree::DeliveryProfile` = ShippingCategory promoted via table rename (`spree_shipping_categories`→`spree_delivery_profiles`, `products.shipping_category_id`→`delivery_profile_id`): store-scoped STI (kinds `DeliveryProfiles::Shipping`/`::Digital` via `Spree.delivery_profile_types`), one default per store, products reference it directly and it's required (auto-assigned: type template else store default; ProductType stamps at creation only — template doctrine). Profile ↔ stock locations (origins, empty=all) + profile→zones + profile→methods; method binds ≤1 zone (m:n join dropped), optional ships-from narrowing per method (no location-group layer — considered, dropped). **Classes only, NO string vocabularies:** method `fulfillment_type` column dropped, `Spree.fulfillment_types` registry + ProductType array deleted; behavior = `FulfillmentProvider` class predicates (`digital?`/`pickup?`/`pickup_point?`/`requires_address?`), rate-provider `requires_address?`, profile kind `digital?`/`requires_shipping_address?` + composition validations. Carts split per profile (`Splitter::DeliveryProfile`); Coordinator allocates only from profile-covered locations. `spree:migrate_delivery_profiles` (5.6→6.0 manifest) does store assignment/kind detection/non-narrowing fold-in/method m:n collapse (`spree_shipping_method_categories` survives to 6.1 as source). ShippingCategory/ShippingMethodCategory classes + associations deleted. Supersedes the string-registry + "named groups 6.1" decisions.
-- `6.0-fulfillment-and-delivery.md` — Shipment→Fulfillment, ShippingMethod→DeliveryMethod, drop ShippingCategory, FulfillmentProvider strategy, pickup (merchant StockLocation) + pickup_point (third-party PickupPointProvider). **Shipped to 6-0-dev (Waves 2+4+6):** renames + deprecated twins, providers (Manual/Digital/Pickup/PickupPoint), dual-emit events, store pickup discovery endpoints, admin delivery_methods/delivery_zones CRUD + dashboard settings pages, FulfillmentMailer; Wave 7 shipping→delivery data migration remains. Pickup work beyond shipped code deferred to 6.1 (2026-08-06): contract hardening (`new(delivery_method)` ctor, `find_nearby` zipcode/query) + how-to guide; `PickupPointProvider::Base` stays **undocumented in 6.0** (v6 docs cover only the delivery rate provider interface) — never add pickup-provider docs in 6.0 work. Delivery mechanics live on provider classes (`pickup_point` provider ships but stays unregistered until 6.1; `local_delivery` cut = shipping + postal-code zone); the string fulfillment-type registry was deleted by `6.0-delivery-profiles.md`. **Partial fulfillment (2026-08-10, resolved question 12):** shipping a subset is `Spree::Fulfillments::Fulfill` (optional per-line-item `items:` + `tracking:` + `notify_customer:`; splits then fulfills in one transaction) — never a state-machine event, since split-then-ship in an `after_transition` is what service-workflows prohibits. **Side effects left the machine (2026-08-10, question 13):** `after_cancel`/`after_resume` are gone as transition callbacks — restock + carrier stand-down live in `Fulfillments::Cancel`/`::Resume` as inline steps (provider call is an `external_step`; `notify_provider: false` lets `Orders::Cancel` delegate and batch carrier I/O after its own transaction), `after_cancel`/`after_resume` are deprecated shells and the only trace left on the model — never add public model methods for workflows to call. **Status model (2026-08-11, question 14): the machine is REMOVED.** `status` = plain `HasStatus` `unfulfilled → fulfilled → delivered | canceled` (`pending`/`ready`/`ready_for_pickup` collapse — payment/stock gating is a `Fulfillments::Fulfill` validate guard, pickup renders modality-aware labels); `delivered` = confirmed receipt (`Fulfillments::MarkDelivered`, `delivered_at`, `fulfillment.delivered`) — the returns window + EU withdrawal anchor; carrier truth is the separate `tracking_status` axis (data, never a machine) written by `Fulfillments::UpdateTracking`, fed by EasyPost tracker webhooks (opt-in trackers for hand-entered numbers). Rollup domain `backorder | canceled | partial | unfulfilled | fulfilled | delivered`. **Phase 7 shipped 2026-08-11** (core + API + dashboard + EasyPost tracker webhook + `spree:migrate_fulfillment_statuses`). **One tracking number per fulfillment (2026-08-11, question 15):** diverging parcels are split fulfillments; a `spree_fulfillment_trackings` model is 6.1 work and must absorb the entire carrier axis (per-row status/`delivered_at`, webhook matching by row) — never split the axis across fulfillment and tracking rows
+- `6.0-fulfillment-and-delivery.md` — Shipment→Fulfillment, ShippingMethod→DeliveryMethod, drop ShippingCategory, FulfillmentProvider strategy, pickup (merchant StockLocation) + pickup_point (third-party PickupPointProvider). **Shipped to 6-0-dev (Waves 2+4+6):** renames + deprecated twins, providers (Manual/Digital/Pickup/PickupPoint), dual-emit events, store pickup discovery endpoints, admin delivery_methods/delivery_zones CRUD + dashboard settings pages, FulfillmentMailer; Wave 7 shipping→delivery data migration remains. Pickup work beyond shipped code deferred to 6.1 (2026-08-06): contract hardening (`new(delivery_method)` ctor, `find_nearby` zipcode/query) + how-to guide; `PickupPointProvider::Base` stays **undocumented in 6.0** (v6 docs cover only the delivery rate provider interface) — never add pickup-provider docs in 6.0 work. Delivery mechanics live on provider classes (`pickup_point` provider ships but stays unregistered until 6.1; `local_delivery` cut = shipping + postal-code zone); the string fulfillment-type registry was deleted by `6.0-delivery-profiles.md`. **Partial fulfillment (2026-08-10, resolved question 12):** shipping a subset is `Spree::Fulfillments::Fulfill` (optional per-line-item `items:` + `tracking:` + `notify_customer:`; splits then fulfills in one transaction) — never a state-machine event, since split-then-ship in an `after_transition` is what service-workflows prohibits. **Side effects left the machine (2026-08-10, question 13):** `after_cancel`/`after_resume` are gone as transition callbacks — restock + carrier stand-down live in `Fulfillments::Cancel`/`::Resume` as inline steps (provider call is an `external_step`; `notify_provider: false` lets `Orders::Cancel` delegate and batch carrier I/O after its own transaction), `after_cancel`/`after_resume` are deprecated shells and the only trace left on the model — never add public model methods for workflows to call. **Status model (2026-08-11, question 14): the machine is REMOVED.** `status` = plain `HasStatus` `unfulfilled → fulfilled → delivered | canceled` (`pending`/`ready`/`ready_for_pickup` collapse — payment/stock gating is a `Fulfillments::Fulfill` validate guard, pickup renders modality-aware labels); `delivered` = confirmed receipt (`Fulfillments::MarkDelivered`, `delivered_at`, `fulfillment.delivered`) — the returns window + EU withdrawal anchor; carrier truth is the separate `tracking_status` axis (data, never a machine) written by `Fulfillments::UpdateTracking`, fed by EasyPost tracker webhooks (opt-in trackers for hand-entered numbers). Rollup domain `backorder | canceled | partial | unfulfilled | fulfilled | delivered`. **Phase 7 shipped 2026-08-11** (core + API + dashboard + EasyPost tracker webhook + `spree:migrate_fulfillment_statuses`); **label leads, fulfilled follows (2026-08-12):** `Fulfillments::PurchaseLabel` = explicit pre-ship label buy (loud failure, no email); `Fulfill` buys label BEFORE marking fulfilled (email always carries tracking; post-split failure keeps the split, never rolls it back); providers declare `generates_labels?` + idempotent `create_fulfillment`. **One tracking number per fulfillment (2026-08-11, question 15):** diverging parcels are split fulfillments; a `spree_fulfillment_trackings` model is 6.1 work and must absorb the entire carrier axis (per-row status/`delivered_at`, webhook matching by row) — never split the axis across fulfillment and tracking rows
- `6.0-returns-exchanges-claims.md` — First-class Return, Exchange, Claim models replacing ReturnAuthorization/Reimbursement chain. **COMPLETE (2026-08-05):** all three entities (+ permanent `ReturnLineItem`/`ExchangeLineItem`/`ClaimLineItem` line items), `Spree::HasStatus`, all fifteen workflows (each with a leading `validate` hook), `Refund#originator`, admin + store v3 APIs (transitions as PATCH member actions; no destroy — cancel instead), dashboard pages. Legacy chain **removed**: ReturnAuthorization/CustomerReturn/Reimbursement/ReimbursementType/legacy ReturnItem + eligibility validators + ReturnsCalculator classes all deleted, but their **tables deliberately survive to 6.1** as the data migration's source and rollback path. `spree:upgrade:migrate_returns` (`Spree::ReturnsMigrator`, defined in the rake file like its sibling upgrade tasks; anonymous-AR readers) is in the 5.6→6.0 manifest after the adjustments step; it needs no cursor because the preserved `number` is uniquely indexed on the new tables, so "what's left" is a `where.not(number: ...)` query and an interrupted run resumes for free. `ReturnAuthorizationReason`→`ReturnReason` (alias one release) + new `ClaimReason`; `Metafields` on all three. Capability replacements: `Spree::ReturnMailer#refunded_email` on `return.refunded` (replaces the reimbursement email), `Order#outstanding_balance` drops the reimbursement term (refunds already net out of `payment_total`), `Return#refunded_total` counts store credits too, `StoreCreditCategory.default_refund_category` (alias kept). **Reasons** ship admin-only CRUD (`/api/v3/admin/{return,claim,refund}_reasons`, `settings` scope) + a combined Settings → Reasons dashboard page + reason pickers on the create dialogs; `mutable` is never client-writable and the immutability guard lives on `Spree::NamedType` (`can_be_deleted?` + rename/destroy guards) because secret API keys authorize by scope and never consult CanCanCan. **No state machines (2026-08-02):** plain `status` string + inclusion validation; all fifteen transitions are workflows (`Returns::Receive`, `Exchanges::Fulfill`, `Claims::Resolve`, …) with `validate` hooks for return-eligibility policy and refunds as `external_step`. Nothing happens in a model or transition callback. Statuses live in a `class_attribute` via the core `Spree::HasStatus` concern (`has_status` + additive `add_status(value, after:)`, generating predicates and scopes) — extensible by design, additive only, and no transition graph (that would be a state machine again). **Return eligibility is a hook, not a policy engine (2026-08-03):** no window/restocking-fee/final-sale flag in core — a `validate` handler decides, enforcing for customers while letting staff override (it reads `created_by`), and region-varying policy reads `order.market`. Medusa/Saleor/Vendure ship no policy at all; Shopify's engine has no API. A `ReturnPolicy` model can arrive later behind the same hook.
- `6.0-platform-auth.md` — Drop Devise, own auth stack, User→Customer/Staff rename (RefreshToken shipped in 5.4)
- `6.0-tax-provider.md` — Per-Market TaxProvider, replaces TaxRate.adjust + Calculator; TaxRate gets direct country/state FKs (tax decoupled from Zone; Zone model dropped in 6.0 via `6.0-delivery-zones.md`); reference provider: Avalara (decisions.md 2026-07-30)
diff --git a/docs/plans/6.0-fulfillment-and-delivery.md b/docs/plans/6.0-fulfillment-and-delivery.md
index 90f1ef50b0..26a94fed82 100644
--- a/docs/plans/6.0-fulfillment-and-delivery.md
+++ b/docs/plans/6.0-fulfillment-and-delivery.md
@@ -411,7 +411,18 @@ Batched, idempotent, resumable — same guarantees as the split-adjustments migr
- `FulfillmentSerializer#fulfillment_type` can drop its computed fallback once every install has run `spree:migrate_shipping_to_delivery`.
- Multiple tracking numbers per fulfillment (`spree_fulfillment_trackings`): the tracking row absorbs the whole carrier axis — per-row status/`delivered_at`, webhook matching by row, fulfillment delivered when every row is; fulfillment-level columns become bridges. Until then, parcels that diverge are split fulfillments (decisions.md 2026-08-11).
-### Phase 7 — status model + delivery tracking ✅ shipped (2026-08-11)
+### Phase 7 — status model + delivery tracking ✅ shipped (2026-08-11; fulfill ordering amended 2026-08-12)
+
+**Amendment (2026-08-12, decisions.md "The label leads, fulfilled follows"):**
+`Fulfillments::PurchaseLabel` is the explicit pre-ship label step (loud
+failures, no status change, no email); `Fulfillments::Fulfill` buys the label
+BEFORE marking fulfilled so the shipped email always carries tracking, and a
+failure after a partial split leaves the split parcel unfulfilled rather than
+rolling it back. Providers declare `generates_labels?` and must make
+`create_fulfillment` idempotent. Admin API: `PATCH .../purchase_label`;
+fulfillment serializer exposes `documents` + `provider_generates_labels`;
+dashboard has Buy label / Print label and a client-generated packing slip.
+
- Schema: `tracking_status`, `tracking_details` (JSON), `estimated_delivery_at`, `delivered_at` on `spree_fulfillments`.
- Swap the machine for `HasStatus`; move transition legality into the four workflows; add `Fulfillments::MarkDelivered` + `Fulfillments::UpdateTracking`; delete `determine_state`.
diff --git a/docs/plans/decisions.md b/docs/plans/decisions.md
index 92fac1beb3..ec699652b6 100644
--- a/docs/plans/decisions.md
+++ b/docs/plans/decisions.md
@@ -1,3 +1,34 @@
+## 2026-08-12: The label leads, fulfilled follows (amends the Phase 7 fulfill flow)
+
+A warehouse prints the label, sticks it on the box, hands the box over — and
+only then is the parcel fulfilled. The fulfill workflow used to invert that:
+status flipped and the shipped email queued first, the label bought after,
+which meant the merchant could not print a label without telling the customer
+the parcel had shipped, the email raced the label purchase for its tracking
+number, and a failed purchase surfaced only after the customer heard.
+
+Two changes. `Fulfillments::PurchaseLabel` is the explicit pre-ship step:
+buys the checkout-quoted rate through the provider, attaches tracking and the
+label document, leaves the status untouched and sends nothing — and fails
+loudly, because nothing has left the building yet. And `Fulfillments::Fulfill`
+reordered its internals to split → buy label (external step) → mark fulfilled,
+so the fulfilled event always sees the provider's tracking number; a label
+failure there still degrades to "no label yet" per the provider doctrine,
+since a carrier outage must never stop a merchant recording a parcel that
+physically left.
+
+Two contracts changed with it: providers must make `create_fulfillment`
+idempotent (a label bought in the explicit step is returned, not re-bought,
+when fulfill later runs), declared via `FulfillmentProvider.generates_labels?`;
+and a failure after a partial-fulfillment split no longer rolls the split
+back — a label may already be bought for the split parcel, and rolling the
+parcel away would orphan a paid label. The split survives unfulfilled and a
+retry picks it up.
+
+Packing slips are the platform's document, not the carrier's — generated
+client-side from data the order screen already holds, no prices, no admin
+shell around them. Plan: `6.0-fulfillment-and-delivery.md`.
+
## 2026-08-11: One tracking number per fulfillment; multiple trackings deferred to 6.1
A fulfillment carries exactly one tracking number, one carrier and one carrier
diff --git a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
index c39ff944bd..f047a14c55 100644
--- a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
+++ b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
@@ -40,8 +40,10 @@ import {
PackageIcon,
PencilIcon,
PlusIcon,
+ PrinterIcon,
RotateCcwIcon,
SplitIcon,
+ TagIcon,
TruckIcon,
XCircleIcon,
} from 'lucide-react'
@@ -54,6 +56,7 @@ import {
fulfillmentItemRows,
unfulfilledItemRows,
} from '../../../lib/fulfillment-items'
+import { printPackingSlip } from '../../../lib/packing-slip'
import { FulfillmentEditDialog } from './fulfillment-edit-dialog'
import { FulfillmentFulfillForm } from './fulfillment-fulfill-form'
import { FulfillmentItemList } from './fulfillment-item-list'
@@ -396,7 +399,7 @@ function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Ful
const { t } = useTranslation()
const confirm = useConfirm()
const orderId = order.id
- const { cancel, resume, markDelivered } = useFulfillmentActions(orderId)
+ const { cancel, resume, markDelivered, purchaseLabel } = useFulfillmentActions(orderId)
const [editOpen, setEditOpen] = useState(false)
const [splitOpen, setSplitOpen] = useState(false)
@@ -415,6 +418,10 @@ function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Ful
(rate) => rate.id === fulfillment.selected_delivery_rate_id,
)
const deliverable = CAN_MARK_DELIVERED.includes(fulfillment.status)
+ // The label leads, fulfilled follows: print the label, pack the box, hand
+ // it over — so buying the label is offered before the parcel ships.
+ const labelDocument = (fulfillment.documents ?? []).find((doc) => doc.kind === 'label')
+ const canBuyLabel = shippable && fulfillment.provider_generates_labels && !labelDocument
const trackable = deliverable && !fulfillment.tracking
return (
@@ -460,6 +467,11 @@ function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Ful
</DropdownMenuItem>
)}
+ <DropdownMenuItem onClick={() => printPackingSlip(order, fulfillment, t)}>
+ <PrinterIcon className="size-4" />
+ {t('admin.orders.detail.fulfillments.print_packing_slip')}
+ </DropdownMenuItem>
+
{deliverable && fulfillment.tracking && (
<DropdownMenuItem onClick={() => setTrackingOpen(true)}>
<TruckIcon className="size-4" />
@@ -546,7 +558,31 @@ function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Ful
<FulfillmentItemList rows={fulfillmentItemRows(fulfillment, order.items ?? [])} />
{shippable && (
- <div className="flex justify-end p-3 border-t">
+ <div className="flex justify-end gap-2 p-3 border-t">
+ {canBuyLabel && (
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ disabled={purchaseLabel.isPending}
+ onClick={() => purchaseLabel.mutate(fulfillment.id)}
+ >
+ <TagIcon data-icon="inline-start" />
+ {purchaseLabel.isPending
+ ? t('admin.actions.saving')
+ : t('admin.orders.detail.fulfillments.buy_label')}
+ </Button>
+ )}
+
+ {labelDocument && (
+ <Button type="button" size="sm" variant="outline" asChild>
+ <a href={labelDocument.url} target="_blank" rel="noopener noreferrer">
+ <PrinterIcon data-icon="inline-start" />
+ {t('admin.orders.detail.fulfillments.print_label')}
+ </a>
+ </Button>
+ )}
+
<Button type="button" size="sm" onClick={() => setFulfilling(true)}>
<TruckIcon data-icon="inline-start" />
{t('admin.orders.fulfill.action')}
@@ -554,6 +590,17 @@ function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Ful
</div>
)}
+ {!shippable && labelDocument && (
+ <div className="flex justify-end p-3 border-t">
+ <Button type="button" size="sm" variant="outline" asChild>
+ <a href={labelDocument.url} target="_blank" rel="noopener noreferrer">
+ <PrinterIcon data-icon="inline-start" />
+ {t('admin.orders.detail.fulfillments.print_label')}
+ </a>
+ </Button>
+ </div>
+ )}
+
{deliverable && (
<div className="flex justify-end gap-2 p-3 border-t">
<Button
diff --git a/packages/dashboard/src/hooks/use-fulfillments.ts b/packages/dashboard/src/hooks/use-fulfillments.ts
index 4151a447fb..ea09dda346 100644
--- a/packages/dashboard/src/hooks/use-fulfillments.ts
+++ b/packages/dashboard/src/hooks/use-fulfillments.ts
@@ -92,5 +92,9 @@ export function useFulfillmentActions(orderId: string) {
adminClient.orders.fulfillments.markDelivered(orderId, fulfillmentId),
)
- return { create, update, split, fulfill, cancel, resume, markDelivered }
+ const purchaseLabel = useFulfillmentMutation(orderId, (fulfillmentId: string) =>
+ adminClient.orders.fulfillments.purchaseLabel(orderId, fulfillmentId),
+ )
+
+ return { create, update, split, fulfill, cancel, resume, markDelivered, purchaseLabel }
}
diff --git a/packages/dashboard/src/lib/packing-slip.ts b/packages/dashboard/src/lib/packing-slip.ts
new file mode 100644
index 0000000000..c3429f8c58
--- /dev/null
+++ b/packages/dashboard/src/lib/packing-slip.ts
@@ -0,0 +1,110 @@
+import type { Fulfillment, Order } from '@spree/admin-sdk'
+import type { TFunction } from 'i18next'
+import { type FulfillmentItemRow, fulfillmentItemRows } from './fulfillment-items'
+
+function escapeHtml(value: string): string {
+ return value
+ .replaceAll('&', '&amp;')
+ .replaceAll('<', '&lt;')
+ .replaceAll('>', '&gt;')
+ .replaceAll('"', '&quot;')
+}
+
+function addressBlock(order: Order): string {
+ const address = order.shipping_address
+ if (!address) return ''
+
+ return [
+ [address.first_name, address.last_name].filter(Boolean).join(' '),
+ address.company,
+ address.address1,
+ address.address2,
+ [address.city, address.state_name ?? address.state_abbr, address.postal_code]
+ .filter(Boolean)
+ .join(', '),
+ address.country_name || address.country_iso,
+ ]
+ .filter(Boolean)
+ .map((line) => escapeHtml(String(line)))
+ .join('<br>')
+}
+
+function itemRows(rows: FulfillmentItemRow[]): string {
+ return rows
+ .map(
+ (row) => `
+ <tr>
+ <td>
+ ${escapeHtml(row.name)}
+ ${row.optionsText ? `<div class="muted">${escapeHtml(row.optionsText)}</div>` : ''}
+ </td>
+ <td class="qty">${row.quantity}</td>
+ </tr>`,
+ )
+ .join('')
+}
+
+/**
+ * Opens a printable packing slip for one fulfillment in a new window.
+ *
+ * Deliberately a generated document rather than an admin route: the admin
+ * shell (sidebar, top bar) would print with an in-app page, and everything
+ * the slip needs is already loaded on the order screen. No prices — a
+ * packing slip says what is in the box, not what it cost.
+ */
+export function printPackingSlip(order: Order, fulfillment: Fulfillment, t: TFunction): void {
+ const rows = fulfillmentItemRows(fulfillment, order.items ?? [])
+
+ const html = `<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>${escapeHtml(t('admin.orders.detail.fulfillments.packing_slip_title', { number: order.number }))}</title>
+<style>
+ body { font-family: -apple-system, system-ui, sans-serif; margin: 40px; color: #111; }
+ h1 { font-size: 20px; margin: 0 0 4px; }
+ .muted { color: #666; font-size: 12px; }
+ .columns { display: flex; gap: 48px; margin: 24px 0; }
+ h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #666; margin: 0 0 6px; }
+ table { width: 100%; border-collapse: collapse; margin-top: 8px; }
+ th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #666;
+ border-bottom: 1px solid #ddd; padding: 6px 0; }
+ td { padding: 8px 0; border-bottom: 1px solid #eee; font-size: 14px; vertical-align: top; }
+ .qty { text-align: right; width: 60px; }
+</style>
+</head>
+<body>
+ <h1>${escapeHtml(t('admin.orders.detail.fulfillments.packing_slip_title', { number: order.number }))}</h1>
+ <div class="muted">${escapeHtml(fulfillment.number ?? '')}</div>
+
+ <div class="columns">
+ <div>
+ <h2>${escapeHtml(t('admin.orders.detail.fulfillments.ship_to'))}</h2>
+ <div>${addressBlock(order)}</div>
+ </div>
+ <div>
+ <h2>${escapeHtml(t('admin.orders.detail.fulfillments.ships_from'))}</h2>
+ <div>${escapeHtml(fulfillment.stock_location?.name ?? '')}</div>
+ </div>
+ </div>
+
+ <table>
+ <thead>
+ <tr>
+ <th>${escapeHtml(t('admin.orders.edit.columns.product'))}</th>
+ <th class="qty">${escapeHtml(t('admin.fields.quantity.label'))}</th>
+ </tr>
+ </thead>
+ <tbody>${itemRows(rows)}</tbody>
+ </table>
+</body>
+</html>`
+
+ const printWindow = window.open('', '_blank')
+ if (!printWindow) return
+
+ printWindow.document.write(html)
+ printWindow.document.close()
+ printWindow.focus()
+ printWindow.print()
+}
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index d4cae3d831..bf6fe3c38f 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -1845,7 +1845,12 @@
"add_tracking_title": "إضافة تتبع",
"tracking_description": "رقم تتبع شركة الشحن، أو رابط تتبع كامل.",
"carrier_label": "شركة الشحن",
- "carrier_auto": "اكتشاف تلقائي"
+ "carrier_auto": "اكتشاف تلقائي",
+ "buy_label": "شراء الملصق",
+ "print_label": "طباعة الملصق",
+ "print_packing_slip": "طباعة قائمة التعبئة",
+ "packing_slip_title": "قائمة التعبئة — الطلب {{number}}",
+ "ship_to": "الشحن إلى"
},
"gift_card_section": {
"applied_suffix": "مُطبَّق",
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index 0371eb6dc5..10c1f1da88 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -1835,7 +1835,12 @@
"add_tracking_title": "Sendungsverfolgung hinzufügen",
"tracking_description": "Die Sendungsnummer des Zustellers oder ein vollständiger Tracking-Link.",
"carrier_label": "Versanddienstleister",
- "carrier_auto": "Automatisch erkennen"
+ "carrier_auto": "Automatisch erkennen",
+ "buy_label": "Label kaufen",
+ "print_label": "Label drucken",
+ "print_packing_slip": "Lieferschein drucken",
+ "packing_slip_title": "Lieferschein — Bestellung {{number}}",
+ "ship_to": "Lieferadresse"
},
"gift_card_section": {
"applied_suffix": "angewendet",
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index 964656600a..0c297e8a32 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -1835,7 +1835,12 @@
"add_tracking_title": "Add tracking",
"tracking_description": "The carrier tracking number, or a full tracking link.",
"carrier_label": "Shipping carrier",
- "carrier_auto": "Detect automatically"
+ "carrier_auto": "Detect automatically",
+ "buy_label": "Buy label",
+ "print_label": "Print label",
+ "print_packing_slip": "Print packing slip",
+ "packing_slip_title": "Packing slip — order {{number}}",
+ "ship_to": "Ship to"
},
"gift_card_section": {
"applied_suffix": "applied",
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index 95f18f6633..f818c6553a 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -1835,7 +1835,12 @@
"add_tracking_title": "Ajouter un suivi",
"tracking_description": "Le numéro de suivi du transporteur, ou un lien de suivi complet.",
"carrier_label": "Transporteur",
- "carrier_auto": "Détecter automatiquement"
+ "carrier_auto": "Détecter automatiquement",
+ "buy_label": "Acheter l'étiquette",
+ "print_label": "Imprimer l'étiquette",
+ "print_packing_slip": "Imprimer le bordereau de colisage",
+ "packing_slip_title": "Bordereau de colisage — commande {{number}}",
+ "ship_to": "Livrer à"
},
"gift_card_section": {
"applied_suffix": "appliqué",
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index e5ad3c6cf0..6977cca411 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -1853,7 +1853,12 @@
"add_tracking_title": "Dodaj śledzenie",
"tracking_description": "Numer przesyłki od przewoźnika lub pełny link do śledzenia.",
"carrier_label": "Przewoźnik",
- "carrier_auto": "Wykryj automatycznie"
+ "carrier_auto": "Wykryj automatycznie",
+ "buy_label": "Kup etykietę",
+ "print_label": "Drukuj etykietę",
+ "print_packing_slip": "Drukuj list przewozowy",
+ "packing_slip_title": "List przewozowy — zamówienie {{number}}",
+ "ship_to": "Adres dostawy"
},
"gift_card_section": {
"applied_suffix": "zastosowano",
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index 131245c9ad..ece07350b1 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -1831,7 +1831,12 @@
"add_tracking_title": "添加物流跟踪",
"tracking_description": "承运商的物流单号,或完整的跟踪链接。",
"carrier_label": "承运商",
- "carrier_auto": "自动识别"
+ "carrier_auto": "自动识别",
+ "buy_label": "购买面单",
+ "print_label": "打印面单",
+ "print_packing_slip": "打印装箱单",
+ "packing_slip_title": "装箱单 — 订单 {{number}}",
+ "ship_to": "收货地址"
},
"gift_card_section": {
"applied_suffix": "已应用",