Draft Orders Plugin

In this guide, you'll learn about the Draft Orders Plugin and its features.

Note: The Draft Orders Plugin was initially only available to Cloud users during its early access phase. It is now available for all Medusa users.

What is the Draft Orders Plugin?#

The Draft Orders Plugin is a Medusa plugin that allows admin users to create and manage draft orders on behalf of customers from the Medusa Admin.

The Medusa application already has the foundation to support draft orders, including data models and API routes. This plugin adds a user interface for managing draft orders in the Medusa Admin dashboard.

The Draft Orders Plugin is especially useful for handling customer support scenarios or when a customer places an order offline, such as over the phone or in-store.

Features#


Install the Draft Orders Plugin#

The Draft Orders Plugin is available in all Medusa applications starting v2.10.0.

For earlier versions, you can install the plugin manually.

To install the Draft Orders Plugin:

  1. Run the following command in your Medusa application's directory:
  1. Add the plugin to your medusa-config.ts file:
medusa-config.ts
1module.exports = defineConfig({2  // ...3  plugins: [4    {5      resolve: "@medusajs/draft-order",6      options: {},7    },8  ],9})

Test the Draft Orders Plugin#

To test the Draft Orders Plugin, start the Medusa application with the following command:

If you open the Medusa Admin at localhost:9000/app and log in, you'll find an "Orders -> Drafts" sidebar item.


Draft Orders User Guides#

To learn how to use the draft order features in the Medusa Admin, refer to the Draft Orders user guides.


How Draft Orders Work#

A draft order is stored in the database as a regular order. It is represented by the Order data model with the following properties:

  • status: Set to draft to indicate that the order is a draft.
  • is_draft_order: Set to true to indicate that the order is a draft order.

So, the same order concepts apply to draft orders as well.

Editing Draft Orders#

Similar to regular orders, draft orders can be edited, allowing admin users to add, update, or remove items, as well as add shipping methods.

When the order edit is confirmed on the draft order, the changes are applied directly to the draft order and its version is incremented.

Converting Draft Orders to Regular Orders#

Once a draft order is finalized and ready for processing, it can be converted to a regular order. This involves:

  • Changing its status property to pending.
  • Changing its is_draft_order property to false.

Admin users can then manage the order like any other regular order, including processing payments and fulfilling items.

Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break