v2.1.1
Highlights
Shipping option rules
We've introduced support for pricing rules on shipping options. Initially, the feature allows you to define prices based on the cart item total. For example, you could have a free shipping option that is only available when the item total is above 100 EUR.
Every time the cart is updated, e.g. with new items, we refresh the shipping methods to ensure the correct price is applied at all times.
You'll find the new setting in the admin dashboard under "Settings > Locations & Shipping > View details > Edit prices (on shipping option)".
New languages
Our admin dashboard has been translated into Japanese.
DML Migrations
Warning
Schema changes
We've migrated our Cart, Sales Channel, API Key, Store, Workflow Engine, and Locking modules to use our Data Model API. These migrations include minor changes to the database schema, primarily around renaming indexes to respect our autogenerated naming conventions.
Read more about each of the schema changes in the PRs below.
Changes to hasOne
As part of our DML work, the behavior of hasOne
has been updated in use cases where it is only defined on one side of the relation. In these cases, the mappedBy
configuration of the hasOne
definition needs to be set to undefined
as it is not present on the other model.
For example:
const email = model.define("email", {
email: model.text(),
isVerified: model.boolean(),
})
const user = model.define("user", {
id: model.number(),
username: model.text(),
email: model.hasOne(() => email, { mappedBy: undefined }), // <------------ Required config
})
Required actions
Run migrations to ensure your server functions as expected after upgrading to v2.1.0:
npx medusa db:migrate
Features
- feat: add support for defining hasOne with FK by @thetutlage in #10441
- refactor: migrate cart module to DML by @thetutlage in #10385
- refactor: migrate sales-channel to DML by @thetutlage in #10452
- refactor: migrate api key module to DML by @thetutlage in #10450
- feat(js-sdk): Make credentials configurable in SDK by @sradevski in #10464
- refactor: migrate store module to DML by @thetutlage in #10467
- feat(core-flows, types): update shipping methods upon cart ops by @riqwan in #10382
- feat(dashboard): SO cart item total rules UI by @kasperkristensen in #10386
Bugs
- fix(dashboard,types): Add missing Metadata form for Region domain and fix payload types by @kasperkristensen in #10449
- fix(core/js-sdk) Add the credentials field in the fetch() only if supported by @sgirones in #10446
- fix(dashboard): Cleanup unsafe accesses to possibly undefined values in order timeline by @kasperkristensen in #10454
- fix(): Deleted default sales channel should be prevented by @adrien2p in #10193
- fix(utils): DML one to one definition by @adrien2p in #10415
- fix(workflows-sdk): name for when/then step by @carlos-r-l-rodrigues in #10459
- fix(framework): add missing query type argument in request types by @shahednasser in #10456
- fix(dashboard): Prevent sending off empty string as handle for product category by @kasperkristensen in #10473
- fix(utils): avoid optional properties on graphql generated file by @carlos-r-l-rodrigues in #10476
- fix(dashboard,types): Fix TS errors by @kasperkristensen in #10457
- fix(promotion, core-flows): updating cart with removed promotion removes adjustments by @riqwan in #10489
- fix(medusa): add query type argument to RequestWithContext by @shahednasser in #10469
- fix(medusa): calculate sales channel availability correctly for variants by @srindom in #10448
Documentation
- docs: add documentation for check constraints by @shahednasser in #10425
- docs: add note about default owner table in many-to-many by @shahednasser in #10426
- docs: generate references manually by @shahednasser in #10438
- docs: revise extend create product by @shahednasser in #10444
- docs: revise query linked records by @shahednasser in #10447
- docs: fix links in extend product guide by @shahednasser in #10472
- docs-util: support new query type argument by @shahednasser in #10468
- docs: revise admin customization pages by @shahednasser in #10466
- docs: revise last chapters of customizations by @shahednasser in #10480
- docs: support detecting broken link cross-projects by @shahednasser in #10483
- docs: fix self hosting deployments not showing by @shahednasser in #10486
- docs: revise main docs outline by @shahednasser in #10502
- docs: fix links to steps in workflow references by @shahednasser in #10503
- docs-util: normalize RelationNullableModifier in model references by @shahednasser in #10505
Chores
- chore(utils): DML#hasOne allow mappedBy to not be defined by @adrien2p in #10442
- chore: locking-postgres provider dml by @carlos-r-l-rodrigues in #10478
- chore(workflow-engine): Migrate to DML by @adrien2p in #10477
Other Changes
New Contributors
Full Changelog: v2.1.0...v2.1.1