fix(core-flows,types,medusa): pass /store/shipping-options fields to workflow (#13527)

cc @willbouch since you asked to be tagged if I opened this PR.

The /store/shipping-options is one of only 2 store endpoints to not allow custom `fields` to be passed(other one is /store/returns if you guys want to add it to the backlog). This PR fixes that so that custom linked models can also be retrieved.

Note: This fix reveals a bug in the next.js starter

https://github.com/medusajs/nextjs-starter-medusa/blob/eac359cc8d52f1d33d8712e18e4e0f38940afb3e/src/lib/data/fulfillment.ts#L23-L24

`fields` was previously ignored, now it errors since it tries to parse the misspelled "fulfllment"(the i is missing). It worked before since both fields are already defined by default inside the workflow. So the `fields` line is totally redundant and should be removed(ideally before merging this).   
Maybe in the next release notes it should also warn users to remove it for those that already have a modified copy of the starter.
This commit is contained in:
Leonardo Benini
2025-09-22 13:31:59 +00:00
committed by GitHub
parent 3758303a1d
commit 458dd04bbf
4 changed files with 28 additions and 10 deletions
@@ -15,11 +15,8 @@ import {
AdditionalData,
ListShippingOptionsForCartWorkflowInput,
} from "@medusajs/types"
import { filterObjectByKeys, isDefined } from "@medusajs/framework/utils"
import {
pricingContextResult,
shippingOptionsContextResult,
} from "../utils/schemas"
import { deduplicate, filterObjectByKeys, isDefined } from "@medusajs/framework/utils"
import { pricingContextResult, shippingOptionsContextResult } from "../utils/schemas"
export const listShippingOptionsForCartWorkflowId =
"list-shipping-options-for-cart"
@@ -256,9 +253,9 @@ export const listShippingOptionsForCartWorkflow = createWorkflow(
}
)
const shippingOptions = useRemoteQueryStep({
entry_point: "shipping_options",
fields: [
const fields = transform(input, ({ fields = [] }) => {
return deduplicate([
...fields,
"id",
"name",
"price_type",
@@ -286,7 +283,11 @@ export const listShippingOptionsForCartWorkflow = createWorkflow(
"calculated_price.*",
"prices.*",
"prices.price_rules.*",
],
])
})
const shippingOptions = useRemoteQueryStep({
entry_point: "shipping_options",
fields,
variables: queryVariables,
}).config({ name: "shipping-options-query" })