Skip to content

fix(core-flows): include variant metadata and dimensions in order fulfillment and shipping workflows - #16752

Open
vjymisal0 wants to merge 2 commits into
medusajs:developfrom
vjymisal0:fix/fulfillment-variant-metadata-query
Open

fix(core-flows): include variant metadata and dimensions in order fulfillment and shipping workflows#16752
vjymisal0 wants to merge 2 commits into
medusajs:developfrom
vjymisal0:fix/fulfillment-variant-metadata-query

Conversation

@vjymisal0

Copy link
Copy Markdown
Contributor

PR title

fix(core-flows): include variant metadata and dimensions in order fulfillment and shipping workflows

What

Hydrate items.variant.metadata, items.variant.thumbnail, and physical dimensions (weight, length, height, width) in useQueryGraphStep across order fulfillment, shipment, cancellation, delivery, and shipping option workflows.

Why

Custom fulfillment providers (such as print-on-demand, dropshipping, and custom warehouse management integrations) and carrier rate calculators rely on line item variant metadata and dimensions to determine vendor SKUs, print options, and shipping constraints. Previously, create-fulfillment, create-shipment, and related workflows omitted items.variant.metadata, leaving providers with no access to variant metadata from the order object (Fixes #16621).

How

  • Updated query graph fields in:
    • create-fulfillment.ts: Added items.variant.metadata and items.variant.thumbnail.
    • create-shipment.ts: Added items.variant.sku, items.variant.barcode, items.variant.title, and items.variant.metadata.
    • cancel-order-fulfillment.ts: Added items.variant.sku and items.variant.metadata.
    • mark-order-fulfillment-as-delivered.ts: Added items.variant.sku and items.variant.metadata.
    • list-shipping-options-for-order.ts: Added items.variant.metadata, items.variant.weight, items.variant.length, items.variant.height, and items.variant.width.
  • Added unit tests in packages/core/core-flows/src/order/workflows/__tests__/order-fulfillment-workflows.spec.ts.
  • Included changeset for @medusajs/core-flows.

Testing

  • Unit tests verifying workflow exports and step definitions in @medusajs/core-flows.
  • Verified TypeScript compilation and field compatibility against remote query schema.

Closes #16621

…fillment and shipping workflows

Hydrate items.variant.metadata, items.variant.thumbnail, and dimensions across create-fulfillment, create-shipment, cancel-fulfillment, delivered, and list-shipping-options workflows so downstream fulfillment providers and carrier rate engines receive complete variant details.
@vjymisal0
vjymisal0 requested a review from a team as a code owner September 7, 2026 12:16
@changeset-bot

changeset-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 53bc5cd

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

This PR includes changesets to release 83 packages
Name Type
@medusajs/core-flows Patch
@medusajs/medusa Patch
@medusajs/test-utils Patch
integration-tests-http Patch
@medusajs/loyalty-plugin Patch
@medusajs/medusa-oas-cli 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/order Patch
@medusajs/payment Patch
@medusajs/pricing Patch
@medusajs/product Patch
@medusajs/promotion Patch
@medusajs/rbac Patch
@medusajs/region Patch
@medusajs/sales-channel Patch
@medusajs/search 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/search-postgres 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/auth-oidc 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/framework Patch
@medusajs/instantsearch-adapter 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
create-medusa-app 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
@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 Sep 7, 2026

Copy link
Copy Markdown

Thanks for the contribution! A few items need to be addressed before this can move forward:

The PR adds variant fields (metadata, dimensions, SKU, barcode, etc.) to the useQueryGraphStep calls in five fulfillment-related workflows. The core intent is correct and matches the linked issue. However, two required changes are needed before this can be merged. First, the added test file contains a wrong expected value for markOrderFulfillmentAsDeliveredWorkflow.getName(). The actual workflow ID defined in the source is "mark-order-fulfillment-as-delivered-workflow" (note the -workflow suffix), but the test asserts "mark-order-fulfillment-as-delivered". This test will fail at runtime. Second, all five modified workflow files have the newly added array element lines indented with 6 spaces, while the surrounding array elements consistently use 8 spaces (4 levels × 2-space indent). Medusa enforces 2-space indentation via Prettier and these lines are misaligned. Non-blocking note: the added tests only verify that each workflow has a known .getName() value — they do not verify that the new query fields are actually present. Stronger tests (e.g. inspecting workflow.__steps or running an integration test) would give more confidence that the fix holds, though this is not blocking approval. Heads up: PR #16622 references the same issue (#16621) and was opened earlier (2026-08-27); if #16622 is merged first, this PR may be closed as a duplicate.

  • packages/core/core-flows/src/order/workflows/tests/order-fulfillment-workflows.spec.ts: wrong workflow ID in test assertion — the test expects markOrderFulfillmentAsDeliveredWorkflow.getName() to equal "mark-order-fulfillment-as-delivered", but the actual markOrderFulfillmentAsDeliveredWorkflowId constant is "mark-order-fulfillment-as-delivered-workflow" (with a -workflow suffix). Update the assertion to match the real ID.
  • cancel-order-fulfillment.ts, create-fulfillment.ts, create-shipment.ts, list-shipping-options-for-order.ts, mark-order-fulfillment-as-delivered.ts: indentation of all added lines is 6 spaces, but the surrounding array elements use 8 spaces. Fix the indentation so the new lines align with the rest of the array (8 spaces at this nesting level).

Triggered by: new PR opened

@medusa-os-bot

medusa-os-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

Thanks for the contribution! Initial automated review looks good.

Both blocking points from the previous review have been resolved. The test assertion for markOrderFulfillmentAsDeliveredWorkflow.getName() now correctly expects "mark-order-fulfillment-as-delivered-workflow" (with the -workflow suffix), matching the actual markOrderFulfillmentAsDeliveredWorkflowId constant. The indentation of all added field strings across the five modified workflow files is now 8 spaces, consistent with the surrounding array elements. The PR adds variant fields (metadata, thumbnail, dimensions, SKU, barcode, title) as static string literals to the useQueryGraphStep field lists in create-fulfillment, create-shipment, cancel-order-fulfillment, mark-order-fulfillment-as-delivered, and list-shipping-options-for-order. All added values are compile-time constants; no user input reaches any query sink. All five workflow IDs asserted in the new test file match their corresponding constants in the source files. The changeset is correctly formatted as a patch for @medusajs/core-flows. No security, performance, or correctness issues were found.

Triggered by: new commit pushed

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.

Fulfillment providers cannot read variant data through the admin fulfillment flow (create-fulfillment omits items.variant.metadata)

1 participant