medusa-fulfillment
Implement Medusa v2 fulfillment — fulfillment module, provider interface, shipping options, fulfillment sets, shipping profiles, and multi-warehouse support. Use when adding fulfillment providers.
Best use case
medusa-fulfillment is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Implement Medusa v2 fulfillment — fulfillment module, provider interface, shipping options, fulfillment sets, shipping profiles, and multi-warehouse support. Use when adding fulfillment providers.
Teams using medusa-fulfillment should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/medusa-fulfillment/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How medusa-fulfillment Compares
| Feature / Agent | medusa-fulfillment | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Implement Medusa v2 fulfillment — fulfillment module, provider interface, shipping options, fulfillment sets, shipping profiles, and multi-warehouse support. Use when adding fulfillment providers.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Medusa v2 Fulfillment
## Before writing code
**Fetch live docs**:
1. Web-search `site:docs.medusajs.com fulfillment module` for fulfillment data model and service methods
2. Web-search `site:docs.medusajs.com fulfillment provider` for the provider abstraction interface
3. Web-search `site:docs.medusajs.com shipping option` for shipping option configuration
4. Fetch `https://docs.medusajs.com/resources/references/fulfillment` and review the `IFulfillmentModuleService` interface
5. Web-search `medusajs v2 AbstractFulfillmentProviderService 2026` for latest provider interface
## Fulfillment Module Architecture
### Entity Relationships
| Entity | Contains | Key Fields |
|--------|----------|------------|
| **FulfillmentSet** | ServiceZones, Fulfillments | name, type (`shipping`, `pick-up`) |
| **ServiceZone** | GeoZones, ShippingOptions | Geographic area with shipping config |
| **ShippingOption** | Rules | name, price_type, provider_id, type |
| **GeoZone** | — | country, province, city, zip |
| **Fulfillment** | Items, Labels | tracking_numbers, packed/shipped/delivered_at |
| **StockLocation** | Link to FulfillmentSet | Warehouse connection |
### Module Links
```
Fulfillment Module ──link──> Stock Location Module (warehouse)
Fulfillment Module ──link──> Cart Module (shipping methods)
Fulfillment Module ──link──> Order Module (order fulfillments)
```
> **Fetch live docs** for exact link definitions and how fulfillment sets connect to stock locations.
## Fulfillment Provider Interface
All providers extend `AbstractFulfillmentProviderService`:
```ts
// Skeleton: custom fulfillment provider
// Fetch live docs for AbstractFulfillmentProviderService
class MyShippingProvider extends AbstractFulfillmentProviderService {
// Implement: validateFulfillmentData, calculatePrice,
// createFulfillment, cancelFulfillment
// Fetch live docs for exact method signatures
}
```
### Required Provider Methods
| Method | Purpose | Returns |
|--------|---------|---------|
| `validateFulfillmentData` | Validate shipping data at checkout | Validated data |
| `validateOption` | Validate shipping option config | Boolean |
| `canCalculate` | Whether provider supports dynamic pricing | Boolean |
| `calculatePrice` | Calculate shipping cost dynamically | Price amount |
| `createFulfillment` | Create fulfillment (generate label) | Fulfillment data |
| `cancelFulfillment` | Cancel an existing fulfillment | void |
| `getFulfillmentDocuments` | Get shipping labels/documents | Document URLs |
| `createReturnFulfillment` | Create return shipment | Return data |
> **Fetch live docs** for exact method signatures, input types, and expected return shapes.
## Shipping Options
### Shipping Option Type
Shipping options reference a `ShippingOptionType` entity with a `label` and `code`. Types are configurable — common patterns include "express", "standard", "economy". The `is_return` rule on a shipping option determines if it applies to returns.
> **Fetch live docs** for how `ShippingOptionType` entities are created and linked.
### Price Types
| Price Type | Description |
|------------|-------------|
| `flat_rate` | Fixed price defined in shipping option |
| `calculated` | Dynamic price calculated by provider at checkout |
### Shipping Option Rules
| Rule Attribute | Example | Description |
|----------------|---------|-------------|
| `enabled_in_store` | `true` | Visible to customers |
| `is_return` | `false` | Available for returns |
| custom attributes | varies | Provider-specific criteria |
> **Fetch live docs** for the full list of rule attributes and how to create custom rules.
## Fulfillment Sets and Geo Zones
| Concept | Description |
|---------|-------------|
| Fulfillment Set | Named group of service zones linked to a stock location |
| Service Zone | Geographic area with associated shipping options |
| Geo Zone | Specific geographic boundary |
| Stock Location Link | Connects fulfillment set to a warehouse |
### Geo Zone Types
| Type | Scope | Example |
|------|-------|---------|
| `country` | Entire country | `country_code: "US"` |
| `province` | State/province | `province_code: "CA"` |
| `city` | City | `city: "San Francisco"` |
| `zip` | Postal code range | `postal_expression: "941*"` |
## Shipping Profiles
| Concept | Description |
|---------|-------------|
| Shipping Profile | Links product types to shipping options |
| Default Profile | Applies to products without explicit assignment |
| Custom Profiles | For oversized, fragile, or special-handling items |
## Multi-Warehouse Support
| Entity | Key Fields |
|--------|------------|
| **StockLocation** | name, address, FulfillmentSet (link) |
| **InventoryItem** | stocked_quantity, reserved_quantity, incoming_quantity |
Each InventoryItem tracks stock per variant per location.
### Fulfillment Routing
| Strategy | Description |
|----------|-------------|
| Nearest warehouse | Ship from closest location to customer |
| Inventory priority | Ship from location with highest stock |
| Manual selection | Admin selects fulfillment location |
> **Fetch live docs** for stock location module service methods and inventory allocation strategies.
## Fulfillment Lifecycle
```
Created ──> Packed ──> Shipped ──> Delivered
└─> Return (if needed)
```
### Key Workflows
| Workflow | Purpose |
|----------|---------|
| `createFulfillmentWorkflow` | Create fulfillment for order items |
| `cancelFulfillmentWorkflow` | Cancel a pending fulfillment |
| `createShipmentWorkflow` | Add tracking and mark shipped |
| `markFulfillmentAsDeliveredWorkflow` | Mark as delivered |
### Key Service Methods
| Operation | Method |
|-----------|--------|
| Create fulfillment set | `fulfillmentModuleService.createFulfillmentSets()` |
| Create service zone | `fulfillmentModuleService.createServiceZones()` |
| Create shipping option | `fulfillmentModuleService.createShippingOptions()` |
| List shipping options | `fulfillmentModuleService.listShippingOptions()` |
| Create fulfillment | `fulfillmentModuleService.createFulfillment()` |
## Best Practices
### Provider Implementation
- Always extend `AbstractFulfillmentProviderService` — do not implement from scratch
- Implement `calculatePrice` accurately — it directly affects checkout totals
- Handle rate API failures gracefully — return cached or fallback rates
- Support both outbound and return fulfillment creation
### Shipping Configuration
- Use geo zones to precisely control shipping option availability by location
- Configure shipping profiles for products with different fulfillment requirements
- Set up both `flat_rate` and `calculated` options — flat rate for simplicity, calculated for accuracy
### Multi-Warehouse
- Link each fulfillment set to exactly one stock location
- Configure service zones per warehouse based on geographic proximity
- Support split shipments — one order may be fulfilled from multiple locations
### Tracking
- Always set tracking numbers when creating shipments
- Subscribe to fulfillment events for customer notification triggers
- Store shipping labels in the fulfillment `data` field
Fetch the Medusa v2 fulfillment module documentation and provider interface references for exact method signatures, shipping option configuration, and multi-warehouse patterns before implementing.Related Skills
ucp-fulfillment
Implement the UCP Fulfillment extension — shipping and pickup methods, destinations, fulfillment groups, selectable options, and estimated delivery. Use when adding shipping/pickup logic to a UCP checkout.
spree-shipping-fulfillment
Build and customize Spree's shipping and fulfillment — ShippingMethod, ShippingCategory, Zone/ZoneMember, ShippingRate, the Stock::Estimator service, StockLocation/StockItem/StockMovement, multi-shipment orders, ShippingCalculator classes (FlatRate, FlatPercentItemTotal, PerItem, FlexiRate), shipment state machine, returns (ReturnAuthorization → CustomerReturn → Reimbursement → Refund), and integrating carrier APIs (UPS, FedEx, ShipStation). Use when configuring shipping rules, building fulfillment integrations, or debugging shipping-rate calculations.
medusa-workflows
Build Medusa v2 workflows — steps with createStep, compensation/rollback, parallel execution, hooks for extending built-in workflows, and when conditions. Use when orchestrating multi-step operations.
medusa-testing
Test Medusa v2 applications — Jest setup, module unit tests, workflow integration tests, API route tests, medusaIntegrationTestRunner, and mock patterns. Use when writing tests for Medusa projects.
medusa-subscribers
Implement Medusa v2 event subscribers — pub/sub event handling, subscriber handler functions, scheduled jobs with cron, and the event module (Redis or in-memory). Use when reacting to commerce events.
medusa-storefront
Build Medusa v2 storefronts with Next.js 15 — App Router, JS SDK client setup, Tanstack Query, server components, product pages, cart, and checkout flow. Use when developing headless storefronts.
medusa-setup
Set up a Medusa v2 development environment — CLI, PostgreSQL/Redis prerequisites, project creation, medusa-config.ts, directory structure, environment variables. Use when starting a new Medusa project.
medusa-security
Secure Medusa v2 applications — authentication strategies, API key types (publishable vs secret), CORS configuration, JWT and cookie secrets, admin vs store auth, and session management. Use when configuring security.
medusa-pricing
Configure Medusa v2 pricing — pricing module, price lists with rules, currencies, tax calculation, regions, and promotion campaigns. Use when setting up pricing and discounts.
medusa-plugins
Develop and publish Medusa v2 plugins — plugin structure, plugin vs module comparison, npm packaging, and reusable plugin template. Use when building distributable Medusa extensions.
medusa-payments
Implement Medusa v2 payment processing — payment module, provider abstraction, payment sessions, authorization/capture/refund lifecycle, and Stripe/PayPal integration. Use when adding payment providers.
medusa-orders
Manage Medusa v2 orders — order lifecycle and state machine, fulfillment workflows, returns, exchanges, claims, draft orders, and order editing. Use when working with order processing.