diff --git a/.changeset/smart-stamps-shake.md b/.changeset/smart-stamps-shake.md new file mode 100644 index 0000000000000..76f141f5f3221 --- /dev/null +++ b/.changeset/smart-stamps-shake.md @@ -0,0 +1,5 @@ +--- +"@medusajs/core-flows": patch +--- + +fix(core-flows): avoid overriding customer and region from setPricingContext hook result diff --git a/packages/core/core-flows/src/cart/workflows/get-variants-and-items-with-prices.ts b/packages/core/core-flows/src/cart/workflows/get-variants-and-items-with-prices.ts index f82931cc03994..47e3285124727 100644 --- a/packages/core/core-flows/src/cart/workflows/get-variants-and-items-with-prices.ts +++ b/packages/core/core-flows/src/cart/workflows/get-variants-and-items-with-prices.ts @@ -105,12 +105,12 @@ export const getVariantsAndItemsWithPrices = createWorkflow( const cart = data.cart const baseContext = { ...filterObjectByKeys(cart, cartFieldsForPricingContext), + customer: cart.customer, + region: cart.region, ...(data.setPricingContextResult ? data.setPricingContextResult : {}), currency_code: cart.currency_code ?? cart.region?.currency_code, region_id: cart.region_id, - region: cart.region, customer_id: cart.customer_id, - customer: cart.customer, } return (data.items ?? cart.items ?? [])