Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Missing is_default_billing and is_default_shipping when requesting addresses #10959

Closed
nilswsr opened this issue Jan 14, 2025 · 1 comment · Fixed by #10970
Closed

Comments

@nilswsr
Copy link

nilswsr commented Jan 14, 2025

Package.json file

{
  "name": "medusa-starter-default",
  "version": "0.0.1",
  "description": "A starter for Medusa projects.",
  "author": "Medusa (https://medusajs.com)",
  "license": "MIT",
  "keywords": [
    "sqlite",
    "postgres",
    "typescript",
    "ecommerce",
    "headless",
    "medusa"
  ],
  "scripts": {
    "build": "medusa build",
    "seed": "medusa exec ./src/scripts/seed.ts",
    "start": "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 --runInBand --forceExit",
    "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit",
    "predeploy": "medusa db:migrate"
  },
  "dependencies": {
    "@medusajs/admin-sdk": "^2.2.0",
    "@medusajs/cli": "^2.2.0",
    "@medusajs/framework": "^2.2.0",
    "@medusajs/medusa": "^2.2.0",
    "@mikro-orm/core": "5.9.7",
    "@mikro-orm/knex": "5.9.7",
    "@mikro-orm/migrations": "5.9.7",
    "@mikro-orm/postgresql": "5.9.7",
    "awilix": "^8.0.1",
    "pg": "^8.13.0"
  },
  "devDependencies": {
    "@medusajs/test-utils": "latest",
    "@mikro-orm/cli": "5.9.7",
    "@swc/core": "1.5.7",
    "@swc/jest": "^0.2.36",
    "@types/jest": "^29.5.13",
    "@types/node": "^20.0.0",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "jest": "^29.7.0",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "vite": "^5.2.11"
  },
  "engines": {
    "node": ">=20"
  }
}

Node.js version

v22.11.0

Database and its version

PostgreSQL 16.3

Operating system name and version

Windows 11

Browser name

No response

What happended?

When requesting a list of the current logged in user addresses via /store/customers/me/addresses the fields is_default_shipping and is_default_billing are missing. As per the docs they should be included. Same goes for requesting a single user address via /store/customers/me/addresses/{address_id}.

Heres an example response for this query /store/customers/me/addresses/cuaddr_01JHJ409BR4SV4W26DMSBXRAQR:

{
    "address": {
        "id": "cuaddr_01JHJ409BR4SV4W26DMSBXRAQR",
        "company": null,
        "customer_id": "cus_01JHDF1K219R0QBVRH9P0XFX2V",
        "first_name": "First Name",
        "last_name": "Last Name",
        "address_1": "Address Line 1",
        "address_2": null,
        "city": "City",
        "province": null,
        "postal_code": "00000",
        "country_code": "de",
        "phone": null,
        "metadata": null,
        "created_at": "2025-01-14T09:58:33.080Z",
        "updated_at": "2025-01-14T09:58:33.080Z"
    }
}

When specifically including the fields in the query, it works as expected, e.g. localhost:9000/store/customers/me/addresses?fields=+is_default_billing,+is_default_shipping:

{
    "addresses": [
        {
            "id": "cuaddr_01JHJ409BR4SV4W26DMSBXRAQR",
            "company": null,
            "customer_id": "cus_01JHDF1K219R0QBVRH9P0XFX2V",
            "first_name": "First Name",
            "last_name": "Last Name",
            "address_1": "Address Line 1",
            "address_2": null,
            "city": "City",
            "province": null,
            "postal_code": "00000",
            "country_code": "de",
            "phone": null,
            "metadata": null,
            "created_at": "2025-01-14T09:58:33.080Z",
            "updated_at": "2025-01-14T09:58:33.080Z",
            "is_default_billing": true,
            "is_default_shipping": true
        }
    ],
    "count": 1,
    "offset": 0,
    "limit": 50
}

Expected behavior

The fields is_default_billing and is_default_shipping are included by default when requesting a single address or a whole address list of the current logged in user.

Actual behavior

The fields is_default_billing and is_default_shipping are missing by default.

Link to reproduction repo

/

@sradevski
Copy link
Member

Yeah I don't see a reason why we don't include them, opened a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants