fix(core-flows): include variant metadata and dimensions in order fulfillment and shipping workflows - #16752
Conversation
…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.
🦋 Changeset detectedLatest commit: 53bc5cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 83 packages
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 |
|
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.
Triggered by: new PR opened |
… tests and format query field indentation
|
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 |
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) inuseQueryGraphStepacross 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 omitteditems.variant.metadata, leaving providers with no access to variant metadata from the order object (Fixes #16621).How
create-fulfillment.ts: Addeditems.variant.metadataanditems.variant.thumbnail.create-shipment.ts: Addeditems.variant.sku,items.variant.barcode,items.variant.title, anditems.variant.metadata.cancel-order-fulfillment.ts: Addeditems.variant.skuanditems.variant.metadata.mark-order-fulfillment-as-delivered.ts: Addeditems.variant.skuanditems.variant.metadata.list-shipping-options-for-order.ts: Addeditems.variant.metadata,items.variant.weight,items.variant.length,items.variant.height, anditems.variant.width.packages/core/core-flows/src/order/workflows/__tests__/order-fulfillment-workflows.spec.ts.@medusajs/core-flows.Testing
@medusajs/core-flows.Closes #16621