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.

Show returns on the order page in the dashboard

Damian Legawieca4281e4d014b
diff --git a/packages/admin-sdk/src/admin-client.ts b/packages/admin-sdk/src/admin-client.ts
index d873d1c802..b2b8f4a3e4 100644
--- a/packages/admin-sdk/src/admin-client.ts
+++ b/packages/admin-sdk/src/admin-client.ts
@@ -147,6 +147,10 @@ import type {
PromotionRuleUpdateParams,
PromotionUpdateParams,
ResourceTypeDefinition,
+ ReturnCreateParams,
+ ReturnReceiveParams,
+ ReturnRefundParams,
+ ReturnUpdateParams,
StockItemUpdateParams,
StockLocationCreateParams,
StockLocationUpdateParams,
@@ -207,6 +211,7 @@ import type {
Refund,
ResourceTranslations,
ResourceTranslationsNode,
+ Return,
Role,
StockItem,
StockLocation,
@@ -989,6 +994,94 @@ export class AdminClient {
}),
},
+ returns: {
+ list: (
+ orderId: string,
+ params?: ListParams & Record<string, unknown>,
+ options?: RequestOptions,
+ ): Promise<PaginatedResponse<Return>> =>
+ this.request<PaginatedResponse<Return>>('GET', `/orders/${orderId}/returns`, {
+ ...options,
+ params: params ? transformListParams(params) : undefined,
+ }),
+
+ get: (
+ orderId: string,
+ id: string,
+ params?: { expand?: string[] },
+ options?: RequestOptions,
+ ): Promise<Return> =>
+ this.request<Return>('GET', `/orders/${orderId}/returns/${id}`, {
+ ...options,
+ params: getParams(params),
+ }),
+
+ create: (
+ orderId: string,
+ params: ReturnCreateParams,
+ options?: RequestOptions,
+ ): Promise<Return> =>
+ this.request<Return>('POST', `/orders/${orderId}/returns`, {
+ ...options,
+ body: params,
+ }),
+
+ update: (
+ orderId: string,
+ id: string,
+ params: ReturnUpdateParams,
+ options?: RequestOptions,
+ ): Promise<Return> =>
+ this.request<Return>('PATCH', `/orders/${orderId}/returns/${id}`, {
+ ...options,
+ body: params,
+ }),
+
+ approve: (
+ orderId: string,
+ id: string,
+ params?: { generate_label?: boolean },
+ options?: RequestOptions,
+ ): Promise<Return> =>
+ this.request<Return>('PATCH', `/orders/${orderId}/returns/${id}/approve`, {
+ ...options,
+ body: params,
+ }),
+
+ receive: (
+ orderId: string,
+ id: string,
+ params?: ReturnReceiveParams,
+ options?: RequestOptions,
+ ): Promise<Return> =>
+ this.request<Return>('PATCH', `/orders/${orderId}/returns/${id}/receive`, {
+ ...options,
+ body: params,
+ }),
+
+ refund: (
+ orderId: string,
+ id: string,
+ params?: ReturnRefundParams,
+ options?: RequestOptions,
+ ): Promise<Return> =>
+ this.request<Return>('PATCH', `/orders/${orderId}/returns/${id}/refund`, {
+ ...options,
+ body: params,
+ }),
+
+ cancel: (
+ orderId: string,
+ id: string,
+ params?: { reason?: string },
+ options?: RequestOptions,
+ ): Promise<Return> =>
+ this.request<Return>('PATCH', `/orders/${orderId}/returns/${id}/cancel`, {
+ ...options,
+ body: params,
+ }),
+ },
+
payments: {
list: (
orderId: string,
diff --git a/packages/admin-sdk/src/params.ts b/packages/admin-sdk/src/params.ts
index dce0b9725e..a8d2e88eb4 100644
--- a/packages/admin-sdk/src/params.ts
+++ b/packages/admin-sdk/src/params.ts
@@ -129,6 +129,49 @@ export interface FulfillmentUpdateParams {
selected_delivery_rate_id?: string
}
+export interface ReturnCreateParams {
+ /** Fulfilled units coming back, and how many of each */
+ items: Array<{ fulfillment_item_id: string; quantity: number }>
+ /** Where the goods come back to; defaults to the location that shipped them */
+ stock_location_id?: string
+ reason_id?: string
+ memo?: string
+}
+
+export interface ReturnUpdateParams {
+ memo?: string
+ reason_id?: string
+ stock_location_id?: string
+ metadata?: Record<string, unknown>
+}
+
+export interface ReturnReceiveParams {
+ /**
+ * What actually arrived. Omit to receive everything as requested and
+ * resellable — pass explicit rows for a partial or damaged receipt, which
+ * is the normal case.
+ */
+ items?: Array<{
+ return_line_item_id: string
+ quantity: number
+ /** Non-resellable goods are received but never restocked */
+ resellable?: boolean
+ }>
+}
+
+export interface ReturnRefundParams {
+ /**
+ * Decimal amount; see `PaymentCreateParams.amount` for the string
+ * rationale. Defaults to the value of what was actually received.
+ */
+ amount?: string | number
+ /**
+ * `store_credit` issues credit immediately; `original_payment` refunds
+ * through the gateway that took the money.
+ */
+ refund_method?: 'original_payment' | 'store_credit'
+}
+
export interface AddressInputParams {
first_name?: string
last_name?: string
diff --git a/packages/admin-sdk/src/types/index.ts b/packages/admin-sdk/src/types/index.ts
index fd3629935f..36ed1159e8 100644
--- a/packages/admin-sdk/src/types/index.ts
+++ b/packages/admin-sdk/src/types/index.ts
@@ -62,7 +62,9 @@ export type { default as PromotionAction } from './generated/PromotionAction'
export type { default as PromotionRule } from './generated/PromotionRule'
export type { default as Refund } from './generated/Refund'
export type { default as Reimbursement } from './generated/Reimbursement'
+export type { default as Return } from './generated/Return'
export type { default as ReturnAuthorization } from './generated/ReturnAuthorization'
+export type { default as ReturnLineItem } from './generated/ReturnLineItem'
export type { default as Role } from './generated/Role'
export type { default as SetupTask } from './generated/SetupTask'
export type { default as State } from './generated/State'
diff --git a/packages/dashboard/src/components/spree/order-returns-card.tsx b/packages/dashboard/src/components/spree/order-returns-card.tsx
new file mode 100644
index 0000000000..da3819de42
--- /dev/null
+++ b/packages/dashboard/src/components/spree/order-returns-card.tsx
@@ -0,0 +1,388 @@
+import type { Return, ReturnLineItem } from '@spree/admin-sdk'
+import {
+ Badge,
+ Button,
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+ Field,
+ FieldLabel,
+ Input,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ StatusBadge,
+ Switch,
+ useConfirm,
+} from '@spree/dashboard-ui'
+import {
+ BanknoteIcon,
+ CheckCircleIcon,
+ EllipsisVerticalIcon,
+ PackageCheckIcon,
+ RotateCcwIcon,
+ XCircleIcon,
+} from 'lucide-react'
+import { useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useOrderReturns, useReturnActions } from '../../hooks/use-returns'
+
+type ReceiptRow = { quantity: number; resellable: boolean }
+
+/** "Product — Small / Blue", falling back to the SKU or the raw id. */
+function variantLabel(line: ReturnLineItem): string {
+ const variant = line.variant
+ if (!variant) return line.variant_id ?? ''
+
+ const parts = [variant.product_name, variant.options_text].filter(Boolean)
+ return parts.length > 0 ? parts.join(' — ') : (variant.sku ?? line.variant_id ?? '')
+}
+
+/**
+ * Returns on an order. Each status change is a distinct action rather than an
+ * editable status field, because each one carries its own arguments —
+ * receiving records what actually arrived, refunding picks where the money
+ * goes.
+ */
+export function OrderReturnsCard({ orderId }: { orderId: string }) {
+ const { t } = useTranslation()
+ const confirm = useConfirm()
+ const { data } = useOrderReturns(orderId)
+ const { approve, receive, refund, cancel } = useReturnActions(orderId)
+
+ const [receiving, setReceiving] = useState<Return | null>(null)
+ const [refunding, setRefunding] = useState<Return | null>(null)
+
+ const returns = data?.data ?? []
+ if (returns.length === 0) return null
+
+ return (
+ <>
+ <Card>
+ <CardHeader>
+ <CardTitle>
+ <RotateCcwIcon className="size-4" />
+ {t('admin.pages.orders.detail.section_returns')}
+ <Badge variant="outline">{returns.length}</Badge>
+ </CardTitle>
+ </CardHeader>
+ <CardContent className="flex flex-col gap-4">
+ {returns.map((returnRecord) => (
+ <div key={returnRecord.id} className="rounded-lg border p-4 flex flex-col gap-3">
+ <div className="flex items-center justify-between">
+ <div className="flex items-center gap-2">
+ <StatusBadge status={returnRecord.status} />
+ <span className="text-sm font-medium">{returnRecord.number}</span>
+ </div>
+
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" size="icon-xs">
+ <EllipsisVerticalIcon className="size-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {returnRecord.status === 'requested' && (
+ <DropdownMenuItem onClick={() => approve.mutate(returnRecord.id)}>
+ <CheckCircleIcon className="size-4" />
+ {t('admin.pages.orders.detail.returns.actions.approve')}
+ </DropdownMenuItem>
+ )}
+ {returnRecord.status === 'approved' && (
+ <DropdownMenuItem onClick={() => setReceiving(returnRecord)}>
+ <PackageCheckIcon className="size-4" />
+ {t('admin.pages.orders.detail.returns.actions.receive')}
+ </DropdownMenuItem>
+ )}
+ {returnRecord.status === 'received' && (
+ <DropdownMenuItem onClick={() => setRefunding(returnRecord)}>
+ <BanknoteIcon className="size-4" />
+ {t('admin.pages.orders.detail.returns.actions.refund')}
+ </DropdownMenuItem>
+ )}
+ {['requested', 'approved'].includes(returnRecord.status) && (
+ <>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ className="text-destructive focus:text-destructive"
+ onClick={async () => {
+ if (
+ await confirm({
+ message: t('admin.pages.orders.detail.returns.confirm.cancel'),
+ variant: 'destructive',
+ confirmLabel: t('admin.actions.cancel'),
+ })
+ ) {
+ cancel.mutate({ returnId: returnRecord.id })
+ }
+ }}
+ >
+ <XCircleIcon className="size-4" />
+ {t('admin.actions.cancel')}
+ </DropdownMenuItem>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+
+ <div className="flex flex-col gap-1.5">
+ {(returnRecord.return_line_items ?? []).map((line) => (
+ <ReturnLineRow key={line.id} line={line} status={returnRecord.status} />
+ ))}
+ </div>
+
+ <div className="flex items-center justify-between text-sm border-t pt-3">
+ <span className="text-muted-foreground">
+ {t('admin.pages.orders.detail.returns.refund_total')}
+ </span>
+ <span className="font-medium">{returnRecord.display_refund_total}</span>
+ </div>
+ </div>
+ ))}
+ </CardContent>
+ </Card>
+
+ {receiving && (
+ <ReceiveDialog
+ returnRecord={receiving}
+ onClose={() => setReceiving(null)}
+ onSubmit={(items) => {
+ receive.mutate({ returnId: receiving.id, items })
+ setReceiving(null)
+ }}
+ />
+ )}
+
+ {refunding && (
+ <RefundDialog
+ returnRecord={refunding}
+ onClose={() => setRefunding(null)}
+ onSubmit={(params) => {
+ refund.mutate({ returnId: refunding.id, ...params })
+ setRefunding(null)
+ }}
+ />
+ )}
+ </>
+ )
+}
+
+function ReturnLineRow({ line, status }: { line: ReturnLineItem; status: string }) {
+ const { t } = useTranslation()
+ const received = ['received', 'refunded'].includes(status)
+
+ return (
+ <div className="flex items-center justify-between text-sm">
+ <span className="truncate">{variantLabel(line)}</span>
+ <span className="flex items-center gap-2 text-muted-foreground">
+ {received && line.received_quantity !== line.quantity && (
+ <Badge variant="outline">
+ {t('admin.pages.orders.detail.returns.received_of', {
+ received: line.received_quantity,
+ requested: line.quantity,
+ })}
+ </Badge>
+ )}
+ {received && !line.resellable && (
+ <Badge variant="outline">{t('admin.pages.orders.detail.returns.not_resellable')}</Badge>
+ )}
+ <span>×{line.quantity}</span>
+ </span>
+ </div>
+ )
+}
+
+/**
+ * Partial and damaged receipt is the normal case, so the dialog opens with
+ * every line editable rather than hiding that behind an "advanced" toggle.
+ */
+function ReceiveDialog({
+ returnRecord,
+ onClose,
+ onSubmit,
+}: {
+ returnRecord: Return
+ onClose: () => void
+ onSubmit: (
+ items: Array<{ return_line_item_id: string; quantity: number; resellable: boolean }>,
+ ) => void
+}) {
+ const { t } = useTranslation()
+ const lines = returnRecord.return_line_items ?? []
+ const [rows, setRows] = useState<Record<string, ReceiptRow>>(() =>
+ Object.fromEntries(
+ lines.map((line) => [line.id, { quantity: line.quantity, resellable: true }]),
+ ),
+ )
+
+ return (
+ <Dialog open onOpenChange={(open) => !open && onClose()}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>{t('admin.pages.orders.detail.returns.receive_title')}</DialogTitle>
+ </DialogHeader>
+ <DialogBody className="flex flex-col gap-4">
+ {lines.map((line) => (
+ <div key={line.id} className="flex flex-col gap-2 rounded-lg border p-3">
+ <span className="text-sm font-medium">{variantLabel(line)}</span>
+ <div className="flex items-center gap-4">
+ <Field className="flex-1">
+ <FieldLabel htmlFor={`qty-${line.id}`}>
+ {t('admin.pages.orders.detail.returns.received_quantity')}
+ </FieldLabel>
+ <Input
+ id={`qty-${line.id}`}
+ type="number"
+ min={0}
+ max={line.quantity}
+ value={rows[line.id]?.quantity ?? 0}
+ onChange={(event) =>
+ setRows((current) => ({
+ ...current,
+ [line.id]: {
+ quantity: Math.min(Number(event.target.value), line.quantity),
+ resellable: current[line.id]?.resellable ?? true,
+ },
+ }))
+ }
+ />
+ </Field>
+ <Field orientation="horizontal">
+ <FieldLabel htmlFor={`resellable-${line.id}`}>
+ {t('admin.pages.orders.detail.returns.resellable')}
+ </FieldLabel>
+ <Switch
+ id={`resellable-${line.id}`}
+ checked={rows[line.id]?.resellable ?? true}
+ onCheckedChange={(checked) =>
+ setRows((current) => ({
+ ...current,
+ [line.id]: {
+ quantity: current[line.id]?.quantity ?? 0,
+ resellable: checked,
+ },
+ }))
+ }
+ />
+ </Field>
+ </div>
+ </div>
+ ))}
+ </DialogBody>
+ <DialogFooter>
+ <Button variant="outline" onClick={onClose}>
+ {t('admin.actions.cancel')}
+ </Button>
+ <Button
+ onClick={() =>
+ onSubmit(
+ lines.map((line) => ({
+ return_line_item_id: line.id,
+ quantity: rows[line.id]?.quantity ?? 0,
+ resellable: rows[line.id]?.resellable ?? true,
+ })),
+ )
+ }
+ >
+ {t('admin.pages.orders.detail.returns.actions.receive')}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ )
+}
+
+function RefundDialog({
+ returnRecord,
+ onClose,
+ onSubmit,
+}: {
+ returnRecord: Return
+ onClose: () => void
+ onSubmit: (params: { refundMethod: 'original_payment' | 'store_credit'; amount?: string }) => void
+}) {
+ const { t } = useTranslation()
+ const [refundMethod, setRefundMethod] = useState<'original_payment' | 'store_credit'>(
+ 'original_payment',
+ )
+ const [amount, setAmount] = useState(returnRecord.refundable_total)
+
+ const methodOptions = [
+ {
+ value: 'original_payment',
+ label: t('admin.pages.orders.detail.returns.refund_methods.original_payment'),
+ },
+ {
+ value: 'store_credit',
+ label: t('admin.pages.orders.detail.returns.refund_methods.store_credit'),
+ },
+ ]
+
+ return (
+ <Dialog open onOpenChange={(open) => !open && onClose()}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>{t('admin.pages.orders.detail.returns.refund_title')}</DialogTitle>
+ </DialogHeader>
+ <DialogBody className="flex flex-col gap-4">
+ <Field>
+ <FieldLabel htmlFor="refund-amount">
+ {t('admin.pages.orders.detail.returns.refund_amount')}
+ </FieldLabel>
+ <Input
+ id="refund-amount"
+ value={amount}
+ onChange={(event) => setAmount(event.target.value)}
+ />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="refund-method">
+ {t('admin.pages.orders.detail.returns.refund_method')}
+ </FieldLabel>
+ <Select
+ items={methodOptions}
+ value={refundMethod}
+ onValueChange={(value) =>
+ setRefundMethod(value as 'original_payment' | 'store_credit')
+ }
+ >
+ <SelectTrigger id="refund-method">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {methodOptions.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </Field>
+ </DialogBody>
+ <DialogFooter>
+ <Button variant="outline" onClick={onClose}>
+ {t('admin.actions.cancel')}
+ </Button>
+ <Button onClick={() => onSubmit({ refundMethod, amount })}>
+ {t('admin.pages.orders.detail.returns.actions.refund')}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ )
+}
diff --git a/packages/dashboard/src/hooks/use-returns.ts b/packages/dashboard/src/hooks/use-returns.ts
new file mode 100644
index 0000000000..d82ce9f16d
--- /dev/null
+++ b/packages/dashboard/src/hooks/use-returns.ts
@@ -0,0 +1,84 @@
+import { adminClient, useResourceKey, useResourceKeyBuilder } from '@spree/dashboard-core'
+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
+
+/**
+ * Returns on an order. Fetched separately from the order itself so the order
+ * payload stays lean — most orders have none.
+ */
+export function useOrderReturns(orderId: string) {
+ return useQuery({
+ queryKey: useResourceKey('order-returns', orderId),
+ queryFn: () =>
+ adminClient.orders.returns.list(orderId, {
+ expand: ['return_line_items', 'return_line_items.variant'],
+ }),
+ enabled: !!orderId,
+ })
+}
+
+/**
+ * A return mutation refreshes both the returns list and the order itself —
+ * refunding changes the order's payment totals.
+ */
+function useReturnMutation<TParams>(
+ orderId: string,
+ mutationFn: (params: TParams) => Promise<unknown>,
+) {
+ const queryClient = useQueryClient()
+ const buildKey = useResourceKeyBuilder()
+
+ return useMutation({
+ mutationFn,
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: buildKey('order-returns', orderId) })
+ queryClient.invalidateQueries({ queryKey: buildKey('orders', orderId) })
+ },
+ })
+}
+
+/**
+ * The four status transitions. Each is its own endpoint because each carries
+ * different arguments — receiving takes the quantities that actually arrived,
+ * refunding takes a method and an amount.
+ */
+export function useReturnActions(orderId: string) {
+ const approve = useReturnMutation(orderId, (returnId: string) =>
+ adminClient.orders.returns.approve(orderId, returnId),
+ )
+
+ const receive = useReturnMutation(
+ orderId,
+ ({
+ returnId,
+ items,
+ }: {
+ returnId: string
+ items?: Array<{ return_line_item_id: string; quantity: number; resellable?: boolean }>
+ }) => adminClient.orders.returns.receive(orderId, returnId, items ? { items } : undefined),
+ )
+
+ const refund = useReturnMutation(
+ orderId,
+ ({
+ returnId,
+ refundMethod,
+ amount,
+ }: {
+ returnId: string
+ refundMethod?: 'original_payment' | 'store_credit'
+ amount?: string
+ }) =>
+ adminClient.orders.returns.refund(orderId, returnId, {
+ refund_method: refundMethod,
+ amount,
+ }),
+ )
+
+ const cancel = useReturnMutation(
+ orderId,
+ ({ returnId, reason }: { returnId: string; reason?: string }) =>
+ adminClient.orders.returns.cancel(orderId, returnId, { reason }),
+ )
+
+ return { approve, receive, refund, cancel }
+}
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index 88a697a223..1d86ebb89a 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -1709,6 +1709,29 @@
"empty_payments": "لا توجد مدفوعات حتى الآن.",
"empty_shipments": "لا توجد شحنات حتى الآن.",
"no_delivery_method": "لم يتم اختيار طريقة توصيل.",
+ "returns": {
+ "actions": {
+ "approve": "موافقة",
+ "receive": "استلام العناصر",
+ "refund": "استرداد"
+ },
+ "confirm": {
+ "cancel": "إلغاء هذا المرتجع؟ لن تتم إعادة أي مخزون ولن يتم تحويل أي مبلغ."
+ },
+ "refund_total": "إجمالي الاسترداد",
+ "received_of": "تم استلام {{received}} من {{requested}}",
+ "not_resellable": "غير قابل لإعادة البيع",
+ "receive_title": "استلام العناصر المرتجعة",
+ "received_quantity": "المستلم",
+ "resellable": "قابل لإعادة البيع",
+ "refund_title": "استرداد المرتجع",
+ "refund_amount": "المبلغ",
+ "refund_method": "استرداد إلى",
+ "refund_methods": {
+ "original_payment": "الدفعة الأصلية",
+ "store_credit": "رصيد المتجر"
+ }
+ },
"section_billing_address": "عنوان إرسال الفواتير",
"section_customer": "العميل",
"section_customer_note": "ملاحظة العميل",
@@ -1717,6 +1740,7 @@
"section_internal_note": "ملاحظة داخلية",
"section_items": "أغراض",
"section_payments": "المدفوعات",
+ "section_returns": "المرتجعات",
"section_shipping_address": "عنوان الشحن",
"section_summary": "ملخص",
"summary": {
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index 540c6a9abe..be9d5f98a3 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -1709,6 +1709,29 @@
"empty_payments": "Noch keine Zahlungen.",
"empty_shipments": "Noch keine Sendungen.",
"no_delivery_method": "Keine Versandmethode ausgewählt.",
+ "returns": {
+ "actions": {
+ "approve": "Genehmigen",
+ "receive": "Artikel annehmen",
+ "refund": "Erstatten"
+ },
+ "confirm": {
+ "cancel": "Diese Retoure stornieren? Es wird nichts eingelagert und kein Geld bewegt."
+ },
+ "refund_total": "Erstattungssumme",
+ "received_of": "{{received}} von {{requested}} erhalten",
+ "not_resellable": "Nicht wiederverkäuflich",
+ "receive_title": "Retournierte Artikel annehmen",
+ "received_quantity": "Erhalten",
+ "resellable": "Wiederverkäuflich",
+ "refund_title": "Retoure erstatten",
+ "refund_amount": "Betrag",
+ "refund_method": "Erstatten an",
+ "refund_methods": {
+ "original_payment": "Ursprüngliche Zahlung",
+ "store_credit": "Guthaben"
+ }
+ },
"section_billing_address": "Rechnungsadresse",
"section_customer": "Kunde",
"section_customer_note": "Kundennotiz",
@@ -1717,6 +1740,7 @@
"section_internal_note": "Interne Notiz",
"section_items": "Artikel",
"section_payments": "Zahlungen",
+ "section_returns": "Retouren",
"section_shipping_address": "Lieferadresse",
"section_summary": "Zusammenfassung",
"summary": {
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index 854b1979e2..48c9bfc6cf 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -1709,6 +1709,29 @@
"empty_payments": "No payments yet.",
"empty_shipments": "No shipments yet.",
"no_delivery_method": "No delivery method selected.",
+ "returns": {
+ "actions": {
+ "approve": "Approve",
+ "receive": "Receive items",
+ "refund": "Refund"
+ },
+ "confirm": {
+ "cancel": "Cancel this return? Nothing will be restocked and no money will move."
+ },
+ "refund_total": "Refund total",
+ "received_of": "{{received}} of {{requested}} received",
+ "not_resellable": "Not resellable",
+ "receive_title": "Receive returned items",
+ "received_quantity": "Received",
+ "resellable": "Resellable",
+ "refund_title": "Refund return",
+ "refund_amount": "Amount",
+ "refund_method": "Refund to",
+ "refund_methods": {
+ "original_payment": "Original payment",
+ "store_credit": "Store credit"
+ }
+ },
"section_billing_address": "Billing address",
"section_customer": "Customer",
"section_customer_note": "Customer note",
@@ -1717,6 +1740,7 @@
"section_internal_note": "Internal note",
"section_items": "Items",
"section_payments": "Payments",
+ "section_returns": "Returns",
"section_shipping_address": "Shipping address",
"section_summary": "Summary",
"summary": {
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index 3f460ae252..c62f553b91 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -1709,6 +1709,29 @@
"empty_payments": "Aucun paiement pour le moment.",
"empty_shipments": "Aucune expédition pour le moment.",
"no_delivery_method": "Aucune méthode de livraison sélectionnée.",
+ "returns": {
+ "actions": {
+ "approve": "Approuver",
+ "receive": "Réceptionner les articles",
+ "refund": "Rembourser"
+ },
+ "confirm": {
+ "cancel": "Annuler ce retour ? Aucun article ne sera remis en stock et aucun montant ne sera remboursé."
+ },
+ "refund_total": "Total du remboursement",
+ "received_of": "{{received}} sur {{requested}} reçus",
+ "not_resellable": "Non revendable",
+ "receive_title": "Réceptionner les articles retournés",
+ "received_quantity": "Reçu",
+ "resellable": "Revendable",
+ "refund_title": "Rembourser le retour",
+ "refund_amount": "Montant",
+ "refund_method": "Rembourser sur",
+ "refund_methods": {
+ "original_payment": "Paiement d’origine",
+ "store_credit": "Avoir"
+ }
+ },
"section_billing_address": "Adresse de facturation",
"section_customer": "Client",
"section_customer_note": "Note du client",
@@ -1717,6 +1740,7 @@
"section_internal_note": "Note interne",
"section_items": "Articles",
"section_payments": "Paiements",
+ "section_returns": "Retours",
"section_shipping_address": "Adresse de livraison",
"section_summary": "Récapitulatif",
"summary": {
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index 3fc3e458ae..db468466ec 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -1717,6 +1717,29 @@
"empty_payments": "Brak płatności.",
"empty_shipments": "Brak przesyłek.",
"no_delivery_method": "Nie wybrano metody dostawy.",
+ "returns": {
+ "actions": {
+ "approve": "Zatwierdź",
+ "receive": "Przyjmij produkty",
+ "refund": "Zwróć płatność"
+ },
+ "confirm": {
+ "cancel": "Anulować ten zwrot? Nic nie wróci do magazynu i żadne pieniądze nie zostaną zwrócone."
+ },
+ "refund_total": "Kwota zwrotu",
+ "received_of": "Otrzymano {{received}} z {{requested}}",
+ "not_resellable": "Nie nadaje się do sprzedaży",
+ "receive_title": "Przyjmij zwrócone produkty",
+ "received_quantity": "Otrzymano",
+ "resellable": "Nadaje się do sprzedaży",
+ "refund_title": "Zwrot płatności",
+ "refund_amount": "Kwota",
+ "refund_method": "Zwróć na",
+ "refund_methods": {
+ "original_payment": "Pierwotna płatność",
+ "store_credit": "Kredyt sklepowy"
+ }
+ },
"section_billing_address": "Adres rozliczeniowy",
"section_customer": "Klient",
"section_customer_note": "Notatka klienta",
@@ -1725,6 +1748,7 @@
"section_internal_note": "Notatka wewnętrzna",
"section_items": "Pozycje",
"section_payments": "Płatności",
+ "section_returns": "Zwroty",
"section_shipping_address": "Adres dostawy",
"section_summary": "Podsumowanie",
"summary": {
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index 6d8d5d0378..4dcb01ce38 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -1709,6 +1709,29 @@
"empty_payments": "暂无付款。",
"empty_shipments": "暂无发货。",
"no_delivery_method": "未选择配送方式。",
+ "returns": {
+ "actions": {
+ "approve": "批准",
+ "receive": "接收商品",
+ "refund": "退款"
+ },
+ "confirm": {
+ "cancel": "取消此退货?不会恢复库存,也不会退款。"
+ },
+ "refund_total": "退款总额",
+ "received_of": "已收到 {{received}} / {{requested}}",
+ "not_resellable": "不可再销售",
+ "receive_title": "接收退回的商品",
+ "received_quantity": "已收到",
+ "resellable": "可再销售",
+ "refund_title": "退货退款",
+ "refund_amount": "金额",
+ "refund_method": "退款至",
+ "refund_methods": {
+ "original_payment": "原支付方式",
+ "store_credit": "商店积分"
+ }
+ },
"section_billing_address": "账单地址",
"section_customer": "客户",
"section_customer_note": "客户备注",
@@ -1717,6 +1740,7 @@
"section_internal_note": "内部备注",
"section_items": "商品",
"section_payments": "付款",
+ "section_returns": "退货",
"section_shipping_address": "收货地址",
"section_summary": "概览",
"summary": {
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx
index babdde2f17..5096a0ba0b 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx
@@ -88,6 +88,7 @@ import {
CustomFieldsInlineCard,
EditableApiCustomFieldsProvider,
} from '../../../../components/spree/custom-fields/custom-fields-inline'
+import { OrderReturnsCard } from '../../../../components/spree/order-returns-card'
import {
orderQueryKey,
useOrder,
@@ -147,6 +148,7 @@ function OrderDetailPage() {
<>
<LineItemsCard order={order} />
<FulfillmentsCard order={order} />
+ <OrderReturnsCard orderId={orderId} />
<PaymentsCard order={order} />
<AdjustmentLinesCard order={order} />
<OrderSummaryCard order={order} />