Fulfillment Module

The Fulfillment Module provides fulfillment-related features in your Medusa and Node.js applications.

How to Use Fulfillment Module's Service#

You can use the Fulfillment Module's main service by resolving from the Medusa container the resource Modules.FULFILLMENT imported from @medusajs/framework/utils.

For example:


Features#

Fulfillment Management#

Create fulfillments and keep track of their status, items, and more.

Code
1const fulfillment = await fulfillmentModuleService.createFulfillment({2  location_id: "loc_123",3  provider_id: "webshipper",4  delivery_address: {5    country_code: "us",6    city: "Strongsville",7    address_1: "18290 Royalton Rd",8  },9  items: [10    {11      title: "Shirt",12      sku: "SHIRT",13      quantity: 1,14      barcode: "123456",15    },16  ],17  labels: [],18  order: {},19})

Integrate Third-Party Fulfillment Providers#

Use third-party fulfillment providers to provide customers with shipping options and fulfill their orders.

Code
1const shippingOption = await fulfillmentModuleService.createShippingOptions({2  // ...3  provider_id: "webshipper",4})

Restrict By Location and Rules#

Shipping options can be restricted to specific geographical locations. You can also specify custom rules to restrict shipping options.

Code
1const serviceZone = await fulfillmentModuleService.createServiceZones({2  name: "US",3  fulfillment_set_id: "fset_123",4  geo_zones: [5    {6      type: "country",7      country_code: "us",8    },9  ],10})11
12const shippingOption = await fulfillmentModuleService.createShippingOptions({13  name: "Express Shipping",14  // restrict location15  service_zone_id: serviceZone.id,16  // restrict by custom rules17  rules: [18    {19      field: "customer_group",20      operator: "eq",21      value: "vip",22    },23  ],24  // ...25})

Support Different Fulfillment Forms#

Support various fulfillment forms, such as shipping or pick up.

Code
1const fulfillmentSets = await fulfillmentModuleService.createFulfillmentSets([2  {3    name: "Shipping",4    type: "shipping",5  },6  {7    name: "Pick-up",8    type: "pick-up",9  },10])

Configure Fulfillment Module#

Refer to this documentation for details on the module's options.

Was this page helpful?
Edit this page