medusajs/medusa

[Bug]: Return fulfillment delivery_address doesn't inherit Order's shipping_address

Closed

#14,830 创建于 2026年2月28日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)TypeScript (22,539 star) (2,090 fork)batch import
Stalegood first issuetype: bugversion: 2.0

描述

Package.json file

{
  "name": "medusa",
  "version": "0.0.1",
  "description": "A starter for Medusa projects.",
  "keywords": [
    "ecommerce",
    "headless",
    "medusa",
    "postgres",
    "sqlite",
    "typescript"
  ],
  "license": "MIT",
  "author": "Medusa (https://medusajs.com)",
  "scripts": {
    "build": "medusa build",
    "seed": "medusa exec ./src/scripts/seed.ts",
    "start": "medusa db:migrate && medusa start",
    "dev": "medusa develop",
    "test:integration:http": "TEST_TYPE=integration:http NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit",
    "test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit",
    "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit",
    "fmt": "oxfmt"
  },
  "dependencies": {
    "@medusajs/admin-sdk": "2.13.3",
    "@medusajs/cli": "2.13.3",
    "@medusajs/framework": "2.13.3",
    "@medusajs/medusa": "2.13.3",
    "algoliasearch": "^5.49.1",
    "react-hook-form": "^7.71.2"
  },
  "devDependencies": {
    "@medusajs/test-utils": "2.13.3",
    "@swc/core": "^1.15.17",
    "@swc/jest": "^0.2.39",
    "@types/jest": "^29.5.14",
    "@types/node": "^20.19.35",
    "@types/react": "^18.3.28",
    "@types/react-dom": "^18.3.7",
    "jest": "^29.7.0",
    "oxfmt": "^0.33.0",
    "prop-types": "^15.8.1",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "ts-node": "^10.9.2",
    "typescript": "^5.9.3",
    "vite": "^5.4.21",
    "yalc": "^1.0.0-pre.53"
  },
  "engines": {
    "node": ">=20"
  },
  "packageManager": "yarn@4.12.0"
}

Node.js version

v24.14.0

Database and its version

PostgreSQL 18.0

Operating system name and version

MacOS 26

Browser name

No response

What happended?

When using the createAndCompleteReturnOrderWorkflow to create a return fulfillment to be used with a custom FulfillmentProvider, the delivery_address passed through createReturnFulfillment's parameter fulfillment is always null. This, in my case, makes it hard to create an official return with the 3rd party provider.

The issue seems to be here: https://github.com/medusajs/medusa/blob/87b5b454afdf7533a167fcb48e069f8c28e4b7e9/packages/core/core-flows/src/order/workflows/return/create-complete-return.ts#L176-L185

We are populating the delivery_address with the values from order.shipping_address, but in the workflow body, we're not including in the fields the shipping_address.*.

https://github.com/medusajs/medusa/blob/87b5b454afdf7533a167fcb48e069f8c28e4b7e9/packages/core/core-flows/src/order/workflows/return/create-complete-return.ts#L357-L371

Adding the shipping_address to the fields array fixed the issue and the createReturnFulfillment now receives the delivery address as expected.

Expected behavior

For the delivery_address to be filled with the data from order.shipping_address.

Actual behavior

delivery_address is always null:

 "delivery_address": {
    "id": "fuladdr_01KJJ7FHHC0C373PJDYJEVB4YW",
    "company": null,
    "first_name": null,
    "last_name": null,
    "address_1": null,
    "address_2": null,
    "city": null,
    "country_code": null,
    "province": null,
    "postal_code": null,
    "phone": null,
    "metadata": null,
    "created_at": "2026-02-28T13:37:18.892Z",
    "updated_at": "2026-02-28T13:37:18.892Z",
    "deleted_at": null
  },

Link to reproduction repo

N/A

贡献者指南

[Bug]: Return fulfillment delivery_address doesn't inherit Order's shipping_address · medusajs/medusa#14830 | Good First Issue