fix: Ensure shipment includes tracking numbers from fulfillment (#11775)
What: Added existing tracking numbers during shipment creation from the admin dashboard Bug details: See #11160
This commit is contained in:
+9
-7
@@ -43,19 +43,21 @@ export function OrderCreateShipmentForm({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const handleSubmit = form.handleSubmit(async (data) => {
|
const handleSubmit = form.handleSubmit(async (data) => {
|
||||||
|
const addedLabels = data.labels
|
||||||
|
.filter((l) => !!l.tracking_number)
|
||||||
|
.map((l) => ({
|
||||||
|
tracking_number: l.tracking_number,
|
||||||
|
tracking_url: "#",
|
||||||
|
label_url: "#",
|
||||||
|
}))
|
||||||
|
|
||||||
await createShipment(
|
await createShipment(
|
||||||
{
|
{
|
||||||
items: fulfillment?.items?.map((i) => ({
|
items: fulfillment?.items?.map((i) => ({
|
||||||
id: i.line_item_id,
|
id: i.line_item_id,
|
||||||
quantity: i.quantity,
|
quantity: i.quantity,
|
||||||
})),
|
})),
|
||||||
labels: data.labels
|
labels: [...addedLabels, ...(fulfillment?.labels || [])],
|
||||||
.filter((l) => !!l.tracking_number)
|
|
||||||
.map((l) => ({
|
|
||||||
tracking_number: l.tracking_number,
|
|
||||||
tracking_url: "#",
|
|
||||||
label_url: "#",
|
|
||||||
})),
|
|
||||||
no_notification: !data.send_notification,
|
no_notification: !data.send_notification,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user