Skip to content

fix(order): select shipping method fields when listing orders with totals - #16241

Open
lazerg wants to merge 2 commits into
medusajs:developfrom
lazerg:fix/order-list-totals-missing-version
Open

fix(order): select shipping method fields when listing orders with totals#16241
lazerg wants to merge 2 commits into
medusajs:developfrom
lazerg:fix/order-list-totals-missing-version

Conversation

@lazerg

@lazerg lazerg commented Jul 30, 2026

Copy link
Copy Markdown

Summary

What — Listing orders while requesting a totals field such as ["id", "total"] no longer throws Shipping method version is required to load adjustments.

Why — This regressed in 2.18.0. Requesting totals makes the repository load shipping method adjustments, and that needs each shipping method's version. Under the SELECT_IN load strategy that paginated list queries use, the shipping methods came back without version, so adjustment loading threw and the request returned a 500.

How — Order items already have a helper that guarantees their fields are selected on the SELECT_IN path, which is why item totals kept working. Shipping methods had no such helper, so this adds the same guarantee for them. Retrieving a single order uses the JOINED strategy and was never affected.

Testing — Added an order module integration test that lists orders with ["id", "total"] and checks the totals load instead of throwing. The full order module integration suite passes locally.

Examples

await query.graph({
  entity: "order",
  fields: ["id", "total"],
  pagination: { skip: 0, take: 3 },
})

Checklist

  • I have added a changeset for this PR
  • The changes are covered by relevant tests
  • I have verified the code works as intended locally
  • I have linked the related issue(s) if applicable

Additional Context

Fixes #16240.

@lazerg
lazerg requested a review from a team as a code owner July 30, 2026 00:44
@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 84575e7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 79 packages
Name Type
@medusajs/order Patch
@medusajs/medusa Patch
@medusajs/test-utils Patch
@medusajs/loyalty-plugin Patch
@medusajs/medusa-oas-cli Patch
integration-tests-http Patch
@medusajs/analytics Patch
@medusajs/api-key Patch
@medusajs/auth Patch
@medusajs/caching Patch
@medusajs/cart Patch
@medusajs/currency Patch
@medusajs/customer Patch
@medusajs/file Patch
@medusajs/fulfillment Patch
@medusajs/index Patch
@medusajs/inventory Patch
@medusajs/link-modules Patch
@medusajs/locking Patch
@medusajs/notification Patch
@medusajs/payment Patch
@medusajs/pricing Patch
@medusajs/product Patch
@medusajs/promotion Patch
@medusajs/rbac Patch
@medusajs/region Patch
@medusajs/sales-channel Patch
@medusajs/settings Patch
@medusajs/stock-location Patch
@medusajs/store Patch
@medusajs/tax Patch
@medusajs/translation Patch
@medusajs/user Patch
@medusajs/workflow-engine-inmemory Patch
@medusajs/workflow-engine-redis Patch
@medusajs/draft-order Patch
@medusajs/oas-github-ci Patch
@medusajs/cache-inmemory Patch
@medusajs/cache-redis Patch
@medusajs/event-bus-local Patch
@medusajs/event-bus-redis Patch
@medusajs/analytics-local Patch
@medusajs/analytics-posthog Patch
@medusajs/auth-emailpass Patch
@medusajs/auth-github Patch
@medusajs/auth-google Patch
@medusajs/caching-redis Patch
@medusajs/file-local Patch
@medusajs/file-s3 Patch
@medusajs/fulfillment-manual Patch
@medusajs/locking-postgres Patch
@medusajs/locking-redis Patch
@medusajs/notification-local Patch
@medusajs/notification-sendgrid Patch
@medusajs/payment-stripe Patch
@medusajs/core-flows Patch
@medusajs/framework Patch
@medusajs/js-sdk Patch
@medusajs/modules-sdk Patch
@medusajs/orchestration Patch
@medusajs/query Patch
@medusajs/types Patch
@medusajs/utils Patch
@medusajs/workflows-sdk Patch
@medusajs/http-types-generator Patch
@medusajs/cli Patch
@medusajs/deps Patch
@medusajs/eslint-plugin Patch
@medusajs/telemetry Patch
@medusajs/admin-bundler Patch
@medusajs/admin-sdk Patch
@medusajs/admin-shared Patch
@medusajs/admin-vite-plugin Patch
@medusajs/dashboard Patch
@medusajs/icons Patch
@medusajs/toolbox Patch
@medusajs/ui-preset Patch
create-medusa-app Patch
@medusajs/ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@medusa-os-bot

medusa-os-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

Thanks for the contribution! Initial automated review looks good.

Fixes a regression where listing orders with totals fields threw a 500 error. The root cause: under SELECT_IN strategy, shipping method fields (including version) were not guaranteed to be selected, so loadShippingAdjustments threw. The fix adds a field-selection helper for shipping methods mirroring the existing ensureOrderItemFieldsSelection pattern. Template complete, issue #16240 linked, changeset and integration test included per checklist. No security, performance, or bug concerns.

Triggered by: new PR opened

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Listing orders with totals throws "Shipping method version is required to load adjustments" in 2.18.0

2 participants