Skip to content

[Bug]: Fulfillment status not updated to "returned" after full return and refund #13882

@eristen-wang

Description

@eristen-wang

Package.json file

{
  "scripts": {
    "build": "medusa build",
    "start": "medusa start --types=false",
    "dev": "medusa develop --types=true --host 0.0.0.0",
  },
  "dependencies": {
    "@google/genai": "^1.19.0",
    "@medusajs/admin-sdk": "2.11.0",
    "@medusajs/cli": "2.11.0",
    "@medusajs/framework": "2.11.0",
    "@medusajs/medusa": "2.11.0",
    "@medusajs/payment-stripe": "2.11.0",
    "@medusajs/workflows-sdk": "2.11.0",
    "@mercurjs/algolia": "file:./src/modules/algolia",
    "@mercurjs/attribute": "file:./src/modules/attribute",
    "@mercurjs/framework": "file:./src/framework",
    "@mercurjs/resend": "file:./src/modules/resend",
    "@mercurjs/reviews": "file:./src/modules/reviews",
    "algoliasearch": "^5.20.2",
    "cloudinary": "^2.7.0",
    "ioredis": "^5.7.0",
    "resend": "^4.1.2",
    "stripe": "^17.4.0"
  },
  "devDependencies": {
    "@eslint/js": "^9.15.0",
    "@medusajs/medusa-oas-cli": "2.11.0",
    "@medusajs/test-utils": "2.11.0",
    "@swc/core": "1.5.7",
    "@swc/jest": "^0.2.36",
    "@trivago/prettier-plugin-sort-imports": "^4.3.0",
    "@types/ioredis": "^5.0.0",
    "@types/jest": "^29.5.13",
    "@types/node": "^20.0.0",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "eslint": "^9.15.0",
    "eslint-plugin-react-hooks": "^5.2.0",
    "globals": "^15.12.0",
    "jest": "^29.7.0",
    "prettier": "^3.3.3",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "typescript-eslint": "^8.15.0",
    "vite": "^5.2.11"
  },
  "engines": {
    "node": ">=20"
  },
  "resolutions": {
    "zod-validation-error": "3.4.1"
  }
}

Node.js version

v24.4.1

Database and its version

supabase

Operating system name and version

macos v26

Browser name

chrome

What happended?

Bug Description

After completing a full return workflow (receiving returned items and processing refund), the order's fulfillment_status remains delivered instead of updating to returned.

Expected Behavior

When all items in an order are returned and refunded, the fulfillment_status should update to returned.

Actual Behavior

The fulfillment_status remains delivered even though:

  • All items have been returned (return_received_quantity = quantity)
  • Full refund has been processed (refunded_total = paid_total)
  • Payment status correctly shows refunded

Steps to Reproduce

  1. Create and complete an order with 1 item
  2. Mark fulfillment as delivered
  3. Customer requests return via Store API
  4. Mark return items as received in Admin
  5. Process full refund
  6. Check order's fulfillment_status - it still shows delivered

Order Data (sanitized)

{
"id": "order_xxx",
"status": "completed",
"display_id": 50,
"version": 7,

"summary": {
"paid_total": 85800,
"refunded_total": 85800,
"pending_difference": "0",
"current_order_total": 0,
"original_order_total": 2400
},

"items": [
{
"id": "ordli_xxx",
"quantity": 1,
"detail": {
"quantity": 1,
"fulfilled_quantity": 1,
"delivered_quantity": 1,
"return_received_quantity": 1,
"return_requested_quantity": 0,
"return_dismissed_quantity": 0
}
}
],

"fulfillments": [
{
"id": "ful_xxx",
"delivered_at": "2025-10-28T13:21:32.772Z",
"canceled_at": null,
"items": [
{
"id": "fulit_xxx",
"quantity": 1
}
]
}
],

"payment_collections": [
{
"id": "pay_col_xxx",
"status": "completed",
"captured_amount": 85800,
"refunded_amount": 85800,
"payments": [
{
"id": "pay_xxx",
"amount": 85800,
"refunds": [
{
"id": "ref_xxx",
"amount": 85800,
"created_at": "2025-10-28T13:43:57.240Z"
}
]
}
]
}
],

"payment_status": "refunded",
"fulfillment_status": "delivered"
}

Expected behavior

According to the documentation, the fulfillment status should be returned when all items are returned.

Actual behavior

the status remains delivered even after the complete return workflow.

Link to reproduction repo

https://github.com/mercurjs/mercur.git

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions