Highlights
This release open sources the Loyalty plugin and includes breaking changes related to Zod, account creation, and more. Please read carefully before updating.
Zod Updated to v4
🚧 Breaking change
Medusa has been upgraded its Zod dependency from v3 to v4. This includes updates to all internal validation schemas and type definitions. For most users, this upgrade is seamless, but if you're using custom validation schemas or directly interacting with Zod types in your project, you may need to:
- Explicitly install Zod v4.2.0 if you have Zod installed in your backend.
- Update your Zod usage based on their migration guide. We've also drafted the following prompt that you can use with agents like Claude Code to migrate your Zod usage:
Zod Migration Agent Prompt
I've updated my project to v2.14.0 of Medusa, which upgrades Zod to v4. This is a breaking change. Migrate all Zod v3 usage in my project to Zod v4.
Do NOT modify anything inside node_modules or the Medusa packages themselves — only migrate my custom code (e.g. custom API routes, modules, workflows, plugins, validators, admin customizations).
## Breaking changes to fix
### Error customization
- Replace `invalid_type_error` and `required_error` options with the unified `error` param
- BEFORE: z.string({ invalid_type_error: "Not a string", required_error: "Required" })
- AFTER: z.string({ error: (issue) => issue.input === undefined ? "Required" : "Not a string" })
- Rename `errorMap` option to `error` wherever used
### ZodError
- Replace `.format()` and `.flatten()` calls with `z.treeifyError(err)`
- Remove `.formErrors` usage (identical to deprecated `.flatten()`)
- Replace `.addIssue()` / `.addIssues()` calls with direct pushes to `err.issues`
### z.string() format validators
- Replace `z.string().email()` with `z.email()` (top-level)
- Replace `z.string().url()` with `z.url()` (top-level)
- Replace `z.string().uuid()` with `z.uuid()` — note: now RFC 9562 strict; use `z.guid()` if lenient matching is needed
- Replace `z.string().ip()` with `z.ipv4()` or `z.ipv6()` depending on intent
- Replace `z.string().cidr()` with `z.cidrv4()` or `z.cidrv6()` depending on intent
- Replace `z.string().emoji()` with `z.emoji()` (top-level)
- Replace `z.string().base64url()` — note it no longer accepts padding
### z.number()
- Remove any inputs passing Infinity or -Infinity — they are now rejected
- Review `.safe()` usage — it now behaves like `.int()` and rejects floats
### z.object()
- Replace `.strict()` with `z.strictObject({ ... })`
- Replace `.passthrough()` with `z.looseObject({ ... })`
- Replace `.strip()` — it's now the default; just remove it
- Remove `.nonstrict()` — deleted entirely
- Remove `.deepPartial()` — deleted; implement manually if needed
- Replace `.merge(other)` with `.extend(other.shape)` or spreading shapes
### z.nativeEnum()
- Replace `z.nativeEnum(MyEnum)` with `z.enum(MyEnum)` — `z.enum()` now handles
native TypeScript enums directly
### z.array()
- Review `.nonempty()` usage — it now returns `string[]` (not a tuple), so type
inference changes if you relied on the first-element guarantee
### z.record()
- Replace single-argument `z.record(valueSchema)` with `z.record(z.string(), valueSchema)`
### .refine()
- Remove type predicate functions from `.refine()` — they no longer narrow types
- Remove any use of `ctx.path` inside refine callbacks — unavailable in v4
- Remove function as second argument to `.refine()` for custom error messages;
use the `error` option in the options object instead:
- BEFORE: schema.refine(fn, (val) => ({ message: `${val} is invalid` }))
- AFTER: schema.refine(fn, { error: (issue) => `${issue.input} is invalid` })
### Removed APIs
- Remove `z.ostring()`, `z.onumber()`, `z.oboolean()` — use `z.string().optional()` etc.
- Remove `z.literal()` with symbol values
- Remove `.create()` static factory calls — use the `z.*()` functions directly
- Remove `z.promise()` wrappers — await the value before parsing instead
### Internal / advanced usage
- Replace `._def` access with `._zod.def` if you introspect Zod schema internals
- Replace `ZodEffects` type references with the appropriate new types
## Instructions
1. Search the entire project (excluding node_modules) for Zod imports and usage.
2. For each file, apply the relevant fixes above.
3. After migrating, build the Medusa project (`medusa build`) which will run TypeScript type checking to catch any remaining type errors introduced by the generics restructure (ZodType now uses only Output and Input generics instead of three).
4. Run any existing tests to verify runtime behavior is unchanged.
5. Summarize what was changed per file.React v19 Support in Icons Package
🚧 Breaking change
The Medusa Icons package has been upgraded to support React v19. If you've installed the icons package directly and haven't upgraded to React v19 yet, you may need to update your React version or pin to an earlier version of the icons package. Otherwise, no action is needed.
Monorepo Project Structure for New Applications
🚧 Breaking change
The create-medusa-app command and medusa new CLI now create projects using a monorepo structure based on the dtc-starter template. This provides better separation of concerns between the backend and storefront applications, and allows you to deploy your project to Medusa Cloud seamlessly.
yarn dlx create-medusa-app@latest my-medusa-store
# Creates a monorepo with separate backend and storefront packagesWith this change, the medusa-starter-default and the Next.js Starter Storefront repositories are now deprecated in favor of the unified monorepo approach.
HTTP Types Consistent with Zod Schemas
🚧 Breaking change
We've updated our HTTP types exported from @medusajs/framework/types to match exactly the Zod schemas used to validate API routes in the Medusa core. This change doesn't impact most users, and it doesn't impact the API routes interfaces. However, if you've explicitly used or relied any of the following types, make sure to apply the required changes.
HTTP types breaking changes
Renamed types
InventoryLevel renamed to AdminInventoryLevel.
AdminPricePreferenceParams renamed to AdminGetPricePreferenceParams.
Properties made required
AdminCreatePricePreference.attribute and .value: changed from optional string? to required string.
AdminCreateProductVariantInventoryKit.required_quantity: changed from optional to required.
Properties removed
AdminProductCategoryListParams.name: removed from the filter type.
BaseClaimListParams.q: search query field removed (also affects AdminClaimListParams).
StoreCustomerAddressFilters.company and .province: removed from store-facing address filters.
Properties with changed types
AdminCreateProductVariantPrice.rules: changed from { region_id: string } | null to Record<string, string> — null is no longer a valid value.
AdminUpdateProductVariant.prices: changed from AdminCreateProductVariantPrice[] to AdminUpdateProductVariantPrice[].
AdminInventoryItemsParams.location_levels: changed from Record<"location_id", string | string[]> to { location_id?: string | string[] }.
metadata in AdminCreateCollection, AdminUpdateCollection, AdminCreateOrderFulfillment, AdminCreateOrderShipment, AdminCreateProductCategory, AdminUpdateProductCategory: changed from Record<string, any> to Record<string, unknown> | null.
AdminCreateFulfillmentItem.line_item_id and .inventory_item_id: changed from string | undefined to string | null.
StoreAddAddress, OrderAddress, AdminFulfillmentDeliveryAddress, BaseCreateCustomerAddress, and BaseUpdateCustomerAddress (first_name, last_name, phone, company, address_1, address_2, city, country_code, province, postal_code, address_name): changed from string | undefined to string | null.
Open Source Loyalty Plugin
The Loyalty Plugin that was previously only available to Medusa Cloud users is now open sourced. It provides features related to gift cards and account credits. You can also build on top of it features like loyalty points, referrals, and more.
To use the Loyalty Plugin, you must install it manually. Run the following command to install it:
yarn add @medusajs/loyalty-plugin # replace with your package managerThen, add it to your list of plugins in medusa-config.ts:
// medusa-config.ts
import { loadEnv, defineConfig } from '@medusajs/framework/utils'
loadEnv(process.env.NODE_ENV || 'development', process.cwd())
module.exports = defineConfig({
// ...
plugins: [
{
resolve: "@medusajs/loyalty-plugin",
options: { },
}
],
})Finally, run migrations to create the necessary tables:
npx medusa db:migrateEnhanced JavaScript SDK with ESM Support
The Medusa JavaScript SDK now includes explicit .js extensions for all relative imports, ensuring full ESM compliance and better compatibility with modern bundlers and Node.js environments.
Repository-wide Currency Code Normalization
Currency codes are now consistently normalized across all modules and APIs throughout Medusa. This ensures consistent handling of currency formatting, validation, and storage across cart, order, payment, pricing, and other commerce modules.
Features
- feat(core-flows,medusa,types): add no_notification to markOrderFulfillmentAsDeliveredWorkflow by @NicolasGorga in #15106
- feat: add support for custom arguments in Twilio Sendgrid email notifications by @420coupe in #14879
- feat(medusa-oas-cli, oas-github-ci): support versioning for outputted oas by @shahednasser in #15123
- feat(dashboard,types): add metadata form to Stock Location by @NicolasGorga in #15025
- feat(core-flows,order,medusa,types): Version shipping method adjustments & implement missing creation flow for versioned adjustments by @NicolasGorga in #14482
- feat(core-flows,order,medusa,types): allow to update the original order.email on order customer transfer requests by @NicolasGorga in #14234
- feat(settings): view configuration enhancement by @adrien2p in #14650
- feat(product,medusa,types): add external id to product tags, collections and types by @asgerjensen in #14855
- feat(admin): add British English for European-style date/time formatting by @mlindholm in #14902
- feat(admin): add Croatian translation by @luxapan in #14919
- feat(order): prevent canceling completed orders by @yangbobo2021 in #14874
- feat(product-category): add external_id to product-category by @asgerjensen in #14799
- feat(core-flows,order,medusa,types): update item metadata on item_update change action by @NicolasGorga in #14570
- feat: Implement event loop instrumentation by @sradevski in #14956
Bugs
- fix(order): remove fields causing excessive stack depth by @shahednasser in #15172
- fix(medusa): optimize currency code normalization migration by @shahednasser in #15165
- fix(loyalty-plugin): migrate to Zod v4 by @shahednasser in #15156
- fix(loyalty-plugin): remove delete gift cards action + cleanup by @shahednasser in #15150
- fix(loyalty-plugin): show gift card products section + error message for expiration date by @shahednasser in #15145
- fix(payment): fix currency code unset when updating payment collection by @shahednasser in #15144
- fix: migrate return reasons list to new DataTable component by @TheSeydiCharyyev in #14916
- fix(medusa): conditionally updated index_data for currency code normalization by @NicolasGorga in #15114
- fix(framework): fix plugin build not outputting server assets by @shahednasser in #15110
- fix(core-flows): consider price and metadata for multiple items linked to a single variant when resolving line action by @NicolasGorga in #14834
- fix: update link for Upgrade Guides in medusa/medusa README.md by @parion in #15038
- fix(dashboard): fix shadowed variable in variant media filters by @ashif323 in #15064
- fix(caching-redis): avoid KEYS scans during tag clears by @flatplanetpl in #14869
- fix(core-flows,types): Fix product export breaking when
sales_channel_idfilter is passed by @NicolasGorga in #14450 - fix:#14410: (medusa,utils): add delay between module migrations to prevent timestamp collision by @bhagwatiprasad in #14436
- fix(admin): handle null sales channel references in product list and detail views by @Vitalini in #15009
- fix(promotion): handle fixed discount type in buy-get promotions by @pitzegluck in #14939
- fix(core-flows): force cart refresh on updatePromotionsWorkflow when refreshing items by @NicolasGorga in #14569
- fix(core-flows): ensure full pricing context when adding items to draft order by @NicolasGorga in #14941
Documentation
- docs: fix section label in monitoring by @shahednasser in #15168
- docs: added agent feedback instructions by @shahednasser in #15167
- docs: capture correct URL for agent visits by @shahednasser in #15160
- docs: fix announcements retrieved from cloud by @shahednasser in #15126
- docs: document ip addresses + subdomains in cloud by @shahednasser in #15102
- docs: added documentation for command palette by @shahednasser in #15066
- docs: update React to 19.2.5 by @shahednasser in #15052
- docs: fix content negotiation not resolving markdown by @shahednasser in #15058
- docs: add bloom emails by @shahednasser in #14895
- docs-util: maintain support for Zod v3 and v4 by @shahednasser in #15138
- docs-utils: make docs generator compatible with Zod v4 by @shahednasser in #15104
- docs-utils: support loyalty plugin in generated references by @shahednasser in #15149
- docs(ui): fix content menu position by @mabouguerra in #15026
Chores
- chore: fix action to draft release by @shahednasser in #15180
- chore: add action to draft releases by @shahednasser in #15179
- chore(docs): cloud doc changes (automated) by @shahednasser in #15173
- chore: add to skill triager and PR reviewer instructions for by-design implementations by @shahednasser in #15158
- chore: change stale bot threshold + automation skill fixes by @shahednasser in #15157
- chore(js-sdk): add methods to manage promotion codes by @asgerjensen in #14850
- chore(loyalty): add tsdocs to services + add index.ts model export by @shahednasser in #15154
- chore: add tsdocs to loyalty plugin workflows and types by @shahednasser in #15147
- chore: trigger PR reviewer when draft PR is ready by @NicolasGorga in #15130
- chore: add linked PR awareness to issue triager by @NicolasGorga in #15121
- chore: fixes to PR reviewer and issue triager by @shahednasser in #15112
- chore: added action to push issue updates to discord by @shahednasser in #15111
- chore: enable issue triager by @shahednasser in #15107
- chore: fix PR reviewer not working on PRs when cursor comments by @shahednasser in #15105
- chore: fix changeset patch by @shahednasser in #15101
- chore: fix http types not matching validators by @shahednasser in #15017
- chore: add pr diff tool for pr reviewer by @shahednasser in #15100
- chore: fix PR reviewer not running automatically by @shahednasser in #15094
- chore: improve PR reviewer by @shahednasser in #15092
- chore(icons): upgrade React to v19 by @NicolasGorga in #14791
- chore(): upgrade zod to latest by @adrien2p in #14309
- chore(docs): cloud doc changes (automated) by @shahednasser in #15076
- chore: add writing tutorials skill by @shahednasser in #15078
- chore: improve guidelines for PR reviewer by @shahednasser in #15073
- chore(api,types): allow filtering on variant sku/barcode/ean/upc on both /store and /admin apis by @asgerjensen in #14826
- chore(medusa,core-flows): include variant images in product export by @NicolasGorga in #14886
- chore(docs): cloud doc changes (automated) by @shahednasser in #15036
- chore: fixes to doc skills and pipelines by @shahednasser in #15067
- chore(cart,order,product,inventory,fulfillment,stock-location,workflow-engine-redis,workflow-engine-inmemory): add missing fields for types auto-generation by @NicolasGorga in #14801
- chore: add pagination to PR review triager by @shahednasser in #15041
- chore: improvement to PR review skill by @shahednasser in #15040
- chore: add issue triager + PR reviewer by @shahednasser in #15001
- chore: allow triggering PR reviewer automatically by @shahednasser in #15055
Other Changes
- Complete Turkish (tr) translations by @onwp in #14991
- Revert "feat: Implement event loop instrumentation (#14956)" by @shahednasser in #15079
- chore(docs): document monitoring in Cloud by @shahednasser in #15113
New Contributors
- @onwp made their first contribution in #14991
- @TheSeydiCharyyev made their first contribution in #14916
- @420coupe made their first contribution in #14879
- @mlindholm made their first contribution in #14902
- @luxapan made their first contribution in #14919
- @flatplanetpl made their first contribution in #14869
- @yangbobo2021 made their first contribution in #14874
- @parion made their first contribution in #15038
- @ashif323 made their first contribution in #15064
- @pevey made their first contribution in #15037
- @bhagwatiprasad made their first contribution in #14436
- @sradevski made their first contribution in #14956
- @Vitalini made their first contribution in #15009
- @pitzegluck made their first contribution in #14939
- @mabouguerra made their first contribution in #15026
Full Changelog: v2.13.6...v2.14.0