www/apps/resources/app/commerce-modules/order/transfer-to-guest/page.mdx
export const metadata = {
title: Transfer Order to Guest Customer,
}
This feature is available since Medusa v2.18.0.
</Note>In this guide, you'll learn how Medusa handles transferring an order to a guest customer.
An admin user can transfer an order from its current customer to a guest customer identified by email. Unlike the request order transfer flow, this transfer is applied immediately without requiring the recipient to accept it.
If no customer exists with the given email address, Medusa creates a new guest customer. The transfer can only be made to guest (non-registered) customers.
The transfer is handled by the transferOrderToGuestWorkflow, which is executed by the Transfer Order to Guest API route.
You can also use this workflow in your customizations:
import { transferOrderToGuestWorkflow } from "@medusajs/medusa/core-flows"
const { result } = await transferOrderToGuestWorkflow(container)
.run({
input: {
order_id: "order_123",
email: "[email protected]",
logged_in_user: "user_123",
},
})
The workflow accepts the following input:
order_id: The ID of the order to transfer.email: The email of the guest customer to transfer the order to. If no customer exists with this email, a guest customer is created.logged_in_user: The ID of the admin user requesting the transfer.description (optional): Details of the transfer.internal_note (optional): A note visible to admin users only.Before applying the transfer, the workflow validates that:
The transferOrderToGuestWorkflow is intended for admin users and applies the transfer immediately.
The requestOrderTransferWorkflow, on the other hand, sends a transfer request that the recipient customer must accept before the transfer is applied. Use that workflow when transferring an order to a registered customer account.