Releases: medusajs/medusa
v2.0.5
Highlights
Product image reordering
Warning
Schema changes
We have introduced support for re-ordering product images. Product images now have a rank
field. The field is set based on the index of the image in the images
payload to create and update products.
For example:
POST /admin/products
{ images: [{ url: "one" }, { url: "two" }]
Will translate to the following:
{ ..., images: [{ url: "one", rank: 0 }, { url: "two", rank: 1 }]
The same pattern is followed when updating the product.
Images are always sorted by the rank.
Schema changes
This feature comes with changes to the data models of the product module:
- The relationship between product and images has changed from a many-to-many to one-to-many. As a result, the pivot table
product_images
has been dropped rank
has been added to theimage
tableproduct_id
has been added to theimage
table
Upgrade guide
To apply the latest migrations run the following command:
npx medusa db:migrate
Cart customer transfers
We have added support for transferring carts from a guest to a registered customer.
The flow is as follows:
Create cart with guest customer
POST /store/carts
{ email: "[email protected]" }
Transfer cart to registered customer
POST /store/carts/:id/customer
The call to transfer assumes you are signed in and uses the customer ID from the authentication context on the request.
New languages
Our admin dashboard has been translated into German, Spaning, Turkish, and Polish
Features
- feat(core-flows): order add quantity diff by @carlos-r-l-rodrigues in #10065
- feat(product): Make product option value linkable by @adrien2p in #10116
- feat(medusa, types, utils, core-flows, order) request & accept order transfer by @fPolic in #10106
- feat: add optional fields by @thetutlage in #10150
- fix(dashboard): order edit - display item quantity change correctly by @fPolic in #10078
- feat(core-flows,medusa): Add API to update cart's customer by @riqwan in #10151
- feat(medusa): request order transfer storefront API by @fPolic in #10156
- feat(types, js-sdk): add updateCustomer to js-sdk by @riqwan in #10158
- feat: add support for making relationships searchable by @thetutlage in #10172
- feat(workflows-sdk): add response to permanent failure by @carlos-r-l-rodrigues in #10177
- feat(medusa): skip draft orders on order list by @riqwan in #10195
- feat(core-flows,medusa): remove cart customer validation + rename workflow by @riqwan in #10207
- feat(dashboard): transfer order admin by @fPolic in #10189
- feat(medusa,core-flows,types,js-sdk): decline / cancel order transfer by @fPolic in #10202
- feat(product,dashboard): Allow re-ordering images by @kasperkristensen in #10187
Bugs
- fix(orchestration): fix set step failure by @carlos-r-l-rodrigues in #10031
- fix(core-flows): capture before order created by @carlos-r-l-rodrigues in #9980
- fix: do not update the .env.template file with the database name by @thetutlage in #10073
- fix(core-flows): Fix date usage accross workflows by @adrien2p in #10100
- fix(admin-shared,dashboard): Add missing injection zones by @kasperkristensen in #10098
- fix(dashboard): Fix active nav link styling for built-in routes by @kasperkristensen in #10082
- fix(dashboard): Add missing inventory list zones by @kasperkristensen in #10117
- fix(dashboard): Add Breadcrumb components by @kasperkristensen in #10079
- fix(product): wrong snapshot name and inexistent script by @adrien2p in #10119
- fix(inventory): update reservation quantity by @carlos-r-l-rodrigues in #10139
- fix(payment): Idempotent cancellation and proper creationg fail handling by @adrien2p in #10135
- fix: add address and customer metadata to tax calc context by @srindom in #10122
- fix(core-flows): Add missing cart sales channel id fields to be part of the application context by @adrien2p in #10142
- fix(product): Update full descendant tree mpath when updating parent category id by @adrien2p in #10144
- fix(dashboard): updated variant title is used when creating product by @riqwan in #10155
- fix(framework,types): correct example of database driver options by @riqwan in #10166
- fix: Remove undefined from events in update by @olivermrbl in #10170
- fix(types): fix AdminBatchProductRequest to have product ID by @shahednasser in #10168
- fix: incorrect changeset breaks preview builds by @riqwan in #10173
- fix: move transfer cart under cart by @riqwan in #10175
- fix(framework): handle deprecated Dirent path by @carlos-r-l-rodrigues in #10179
- feat(medusa): enable price list prices for product endpoints by @riqwan in #10197
- fix: Update js-sdk with token by @olivermrbl in #10211
- fix(types): Graph types fixes by @adrien2p in #10220
- fix(js-sdk): Preserve
path
inbaseUrl
by @kasperkristensen in #10222 - fix(admin-vite-plugin): Move @babel/types to dependencies from devDependencies to make it compatible with Yarn PnP by @kasperkristensen in #10236
Documentation
- Fix grammar issue in the doc by @webgodo in #10064
- Fix Typo in Documentation by @hadicph in #9989
- docs: fix slugs pointing to admin rather than store routes by @shahednasser in #10063
- docs: remove duplicate buttons in code actions by @shahednasser in #10061
- docs: add documentation on validateAndTransformQuery by @shahednasser in #10060
- docs: fix error to medusa configuration guide by @shahednasser in #10059
- docs: update event module guide by @shahednasser in #10056
- docs: document multiple steps usage in a workflow by @shahednasser in #10053
- docs: change useRemoteQueryStep to useQueryGraphStep by @shahednasser in #10051
- docs-util: fix helper step settings by @shahednasser in #10045
- docs: added note about test timeout by @shahednasser in #10041
- docs: fix outdated links by @shahednasser in #10040
- docs: add emit events + types documentation by @shahednasser in #10026
- docs: fix types of injection zone props by @shahednasser in #10074
- docs: added + updated build and deployment guides by @shahednasser in #10019
- docs: update to next 15 + eslint 9 by @shahednasser in #9839
- docs: fix oneOf design hiding more than three items by @shahednasser in #10077
- docs-utils: make reference table of content in alphabetical order by @shahednasser in #10084
- docs: improv version detection + fix breadcrumbs by @shahednasser in #10083
- docs: add missing import in digital product recipe by @shahednasser in #10094
- docs: fix client error for learning path by @shahednasser in #10102
- docs: add guide on how to translate admin by @shahednasser in #10095
- docs: update admin injection zones list by @shahednasser in #10103
- docs: add note about using dates in workflows by @shahednasser in #10107
- docs: document nested UI routes by @shahednasser in #10104
- docs: fix copy in code blocks with tabs by @shahednasser in #10123
- docs: add missing prerequisite in stripe's storefront integration by @shahednasser in #10097
- docs: S3 p...
v2.0.4
Highlights
Improved pluralization of MedusaService
types
Warning
Breaking change: If you have created data models using the uncountable nouns and special rules below, you might be affected.
We've updated the type helper used to generate types for the methods of the MedusaService
. It now has two conditional checks when converting a singular value to a plural value at the types level.
- First, it checks for uncountable nouns in a dictionary.
- Second, it looks for special rules for certain words like tooth, man, etc.
You can find the reference of uncountable nouns and special rules here.
Bugs
- breaking: pluralize type helper to account for uncountable nouns and special rules by @thetutlage in #10011
- fix(types): Add AdminBatchUpdateProductVariant type by @kasperkristensen in #10009
- fix(medusa, types): filter product by external_id by @fPolic in #10010
- fix(dashboard): handle deleted products/variants in the order domain by @fPolic in #9841
- fix(dashboard): Load product variant edit page and fix product detail query key by @kasperkristensen in #10029
Documentation
- docs: improve transform docs by @shahednasser in #10023
- docs: fix link to testing tools by @shahednasser in #10030
- docs: improve getting started chapters by @shahednasser in #10014
- docs: fix cart completion in subscriptions recipe by @shahednasser in #10021
Chores
- chore(medusa): show success message after user is created by @shahednasser in #10027
Other Changes
- docs: add changeset for #10011 by @thetutlage in #10018
Full Changelog: v2.0.3...v2.0.4
v2.0.3
Highlights
Replaced email
with sub
for Google entity ID
The Google authentication provider incorrectly used the email as the entity_id,
which is an issue in case a Google account has multiple emails attached to it. This release fixes that and switches the usage to the sub
field as a globally unique identifier.
If you have been using the Google authentication provider, the easiest way to migrate existing data is to hot patch @medusajs/auth-google
using https://www.npmjs.com/package/patch-package so that when validating the callback, both the email
and sub
fields are used to retrieve the user, but only the sub
is written.
See this PR for more.
Patched security issue
This release contains an important security fix for the email-password authentication provider. Please update your project as soon as possible.
The security issue was found in the password reset flow when using the email-password authentication provider. By obtaining a password reset token, it was possible to update the provider_metadata
of other usersβ provider identities by including a specific payload in the password reset request. To minimize risk to affected users, we will not disclose the structure of the payload.
Bugs
- fix: Use sub instead of email for google entity ID by @sradevski in #9949
- fix: commands to run from within the
.medusa/server
directory by @thetutlage in #9941 - fix(dashboard): user invite search by @fPolic in #9973
- fix(core-flows): pass metadata on order fulfillment create by @fPolic in #9974
- fix(framework): exclude nested fields when excluding requested field by @carlos-r-l-rodrigues in #9979
- fix(link-modules): generate graphql type of read only links by @carlos-r-l-rodrigues in #9955
- fix: define ssl options when specified in the connection string by @thetutlage in #9992
- fix(dashboard): Reduce data loaded by product details page by @kasperkristensen in #9991
- fix(core-flows): keep same customer on cart update by @carlos-r-l-rodrigues in #9977
Documentation
- docs: add common redirects to v1 docs by @shahednasser in #9832
- docs: fix resolve of custom file module guide by @shahednasser in #9840
- docs: remove upgrade guides doc by @shahednasser in #9845
- docs: add instructions on how to roll back a migration by @shahednasser in #9870
- docs: add more context and description to recipe steps by @shahednasser in #9861
- docs: fix server worker mode in railway deployment by @shahednasser in #9842
Chores
- chore: remove husky by @thetutlage in #9967
- chore: Add new i18n validation workflows for the admin by @adrien2p in #9948
- chore: update doc links in README by @shahednasser in #9860
Other Changes
- feat(stripe): add promptpay by @oDestroyeRo in #9789
New Contributors
- @oDestroyeRo made their first contribution in #9789
Full Changelog: v2.0.2...v2.0.3
v2.0.2
This version fixes a range of bugs reported in the 2.0.0 release.
Highlights
Fixed mismatch with tax rate rule override
We identified a mismatch between how tax rate rule overrides were referenced in the dashboard and in the tax engine. When created through the dashboard, the overrides were created with an attribute key in plural form, but our tax engine expects them to be in the singular form.
For example, if you defined a tax rate rule override for a Product Collection, the dashboard would pass product_collections
upon creating the override while the tax engine would look for product_collection
.
Additionally, we fixed an issue with missing product type IDs on cart and order line items, which would mean tax calculations were not performed for product types.
These bugs were fixed in #9796 and #9951
Required actions
- Re-create your tax rate rule overrides
- Run migrations
npx medusa db:migrate
Features
- chore(dashboard): Setup test and script for validating i18n by @kasperkristensen in #9799
- refactor: move to a form based bug report template by @thetutlage in #9930
Bugs
- fix(dashboard): Allow float values for product prices by @kasperkristensen in #9859
- fix(core-flows, dashboard): adjust stock levels when doing partial fulfilments by @fPolic in #9736
- fix(dashboard): tax override reference by @fPolic in #9796
- fix: consider --host flag and HOST env variable by @thetutlage in #9912
- fix: disable admin when running integration tests by @thetutlage in #9915
- fix(dashboard): truncate price cell titles by @fPolic in #9715
- fix(utils): Mikro orm repository update many to many should detach all items by default by @adrien2p in #9917
- fix(workflows-sdk): Paralellize steps rollback issue with config by @adrien2p in #9921
- fix(dashboard): Allow using enter key to create newline in Textarea by @kasperkristensen in #9913
- fix(types): Prev limit wrong values by @adrien2p in #9935
- fix(utils/dml): set-relationship graphql generator from DML wrong managed belongsTo by @adrien2p in #9932
- fix(telemetry): Pointing and resolving packages wrongly by @adrien2p in #9939
- fix: Support relative path in SDK by @sradevski in #9942
- fix(medusa): POST carts/[id]/complete missing early return by @SGFGOV in #9914
- fix: Default to a relative path for the admin backend URL by @sradevski in #9947
- fix: log cause property from the error by @thetutlage in #9944
- fix(core-flows,medusa): Include region_id in shipping option retrieval by @olivermrbl in #9929
- fix: do not set default host to localhost by @thetutlage in #9957
- fix(types): add
display_id
toOrderDTO
by @fPolic in #9953
Documentation
- docs: added documentation on environment variables by @shahednasser in #9798
- docs : Update page.mdx referring by @Ratnadeep2k in #9820
- docs: add a note in 404 page about v1 docs by @shahednasser in #9815
- fix(docs): small error by @0xflotus in #9868
- docs: small improvement to first customization guide by @shahednasser in #9843
Chores
- chore(js-sdk,types): add tsdocs for admin JS SDK methods [4/n] by @shahednasser in #9745
- chore: Sync PR and Discussions to Linear by @olivermrbl in #9938
- chore: Use PR author name by @olivermrbl in #9940
- chore(locking): disable default provider warning by @carlos-r-l-rodrigues in #9956
New Contributors
- @Ratnadeep2k made their first contribution in #9820
- @eltociear made their first contribution in #9818
Full Changelog: v2.0.1...v2.0.2
v2.0.1
This version fixes a range of bugs reported in the 2.0.0 release.
Features
- feat(core-flows, dashboard, js-sdk): customer batch endpoint for managing customer groups by @fPolic in #9761
- feat(dashboard, medusa, types): orders list on customer details page by @fPolic in #9790
- feat: Allow customer metadata update by @docloulou in #9780
Bugs
- fix: missing dependency in dev-cli by @thetutlage in #9730
- fix: install preview version of dev-cli by @thetutlage in #9750
- fix(js-sdk): remove list and retrieve methods of paymentCollection by @shahednasser in #9746
- fix(dashboard): Prevent reusing same Component for nested UI routes by @kasperkristensen in #9725
- fix(dashboard): Workflow executions by @adrien2p in #9757
- fix(medusa): Admin validator filtering and pagination by @adrien2p in #9748
- feat(dashboard,ui): DateFilter should open correctly by @kasperkristensen in #9775
- fix(core-flows, dashboard): products category batch issue by @fPolic in #9766
- fix(orchestration): Ids wrongly processed when using operators map by @adrien2p in #9781
Documentation
Important
The documentation for Medusa v1 has moved from https://docs.medusajs.com to https://docs.medusajs.com/v1.
- docs: remove v1 docs from navbar by @shahednasser in #9722
- docs: remove dev notices + fix AI assistant answer width by @shahednasser in #9686
- Update docs commerce modules so that tax links to the correct page by @jackcaldwell in #9747
- docs: show latest version in docs + update automatically by @shahednasser in #9753
- docs: fix deleteCascade typo by @shahednasser in #9744
- docs: change configurations to make v2 the main docs by @shahednasser in #9729
- docs: add ui rewrite by @shahednasser in #9762
- docs: fix complete cart workflow usage in marketplace recipe by @shahednasser in #9771
- docs: fixes to ui docs by @shahednasser in #9759
Chores
- chore: update links to v2 docs in source code and comments by @shahednasser in #9732
- chore: Add fixed packages in changeset by @olivermrbl in #9752
- chore(js-sdk,types): add tsdocs for admin JS SDK methods [5/n] by @shahednasser in #9788
New Contributors
- @jackcaldwell made their first contribution in #9747
- @docloulou made their first contribution in #9780
Full Changelog: v2.0.0...v2.0.1
Medusa 2.0 Release Candidate #8
Get started with a new project
To get started using the RC, run the following command:
npx create-medusa-app@rc
This command will create a new Medusa project with our redesigned admin and a 2.0-compatible Next.js storefront. The Medusa application and the Next.js storefront are separate projects in separate folders.
Update existing project
Ensure your Medusa dependencies in package.json
are using the rc
tag:
{
"dependencies": {
"@medusajs/admin-sdk": "rc",
"@medusajs/framework": "rc",
"@medusajs/medusa": "rc",
"@medusajs/medusa-cli": "rc",
...
}
}
To ensure an upgrade to a new version is completed correctly, run the following sequence of commands:
rm -rf node_modules
rm yarn.lock // or package-lock.json
yarn // If you are using yarn berry, you need to create the lock-file first
Features
- fix(medusa, types): allow to pass
external_id
on product create/update by @fPolic in #9694 - feat(dashboard,types): Translate all OrderBy filters by @kasperkristensen in #9691
- feat(core-flows): order events by @carlos-r-l-rodrigues in #9702
- feat(core-flows,medusa): Add customer validation on cart update by @riqwan in #9662
- Feat/validate query enhancement by @adrien2p in #9705
Bugs
- fix(dashboard,js-sdk): remove method and hook for deleting claim by @shahednasser in #9668
- fix(dashboard, js-sdk): undefined RMA activity items by @fPolic in #9649
- fix(core-flows): Emit event in update products workflow by @olivermrbl in #9682
- fix(dashboard): wrong queryKey for price preferences list by @fPolic in #9685
- fix(dasboard): Grammer issues on invite page by @kasperkristensen in #9683
- fix: allow additional_data to be undefined or null by @thetutlage in #9687
- fix(product): Category repository missing ontext by @adrien2p in #9688
- fix(dashboard,js-sdk): remove methods / hooks to non existing exchange routes by @shahednasser in #9697
- fix: Don't store token in SDK by default by @sradevski in #9704
- fix(admin-vite-plugin,dashboard): Generate correct UI Route tree by @kasperkristensen in #9699
- fix(dashboard): temp hide order column on reservations by @fPolic in #9692
- fix(dashboard): broken CustomerGroup create form by @fPolic in #9711
- fix(dasbhoard): Revert keybound form for public pages by @kasperkristensen in #9710
- fix: API validation management issues by @adrien2p in #9693
Documentation
- docs: rename packages by @shahednasser in #9618
- docs-util: fixes to package renames + other options by @shahednasser in #9671
- docs: fix scroll + divider issues by @shahednasser in #9663
- fix: revise words on docs intro page by @srindom in #9588
- docs: update nav items by @shahednasser in #9709
Chores
- chore(utils): update tsdocs for provider identifiers by @shahednasser in #9656
- chore(orchestration): modules method context by @carlos-r-l-rodrigues in #9669
- chore: fix to DML action by @shahednasser in #9672
- chore(types,js-sdk,medusa): Add TSDocs for store and auth's JS SDK + small type fixes by @shahednasser in #9657
- chore: Correctly assert test by @sradevski in #9695
- chore(js-sdk,types): add tsdocs for admin JS SDK methods [1/n] by @shahednasser in #9667
- chore(js-sdk,types): add tsdocs for admin JS SDK methods [2/n] by @shahednasser in #9696
- chore(js-sdk,types): add tsdocs for admin JS SDK methods [3/n] by @shahednasser in #9712
Full Changelog: v2.0.0-rc.7...v2.0.0-rc.8
v2.0.0
Medusa v.2.0.0
Weβre excited to announce the release of Medusa 2.0 to the world today. This major version has been over 16 months in the making, with more than 3500 pull requests merged, and represents an incredible engineering feat by our team.
Medusa 2.0 is a complete rewrite of our architecture and feature set with breaking changes to many areas of Medusa 1.0. While we recognize this may be disruptive for our users, we deemed these changes necessary to establish the proper foundation for our vision of the future of building applications with Medusa.
Since this is a complete rewrite and we have yet to finalize an upgrade guide, there is no point in covering all the breaking changes in this announcement. You can expect this to be covered in the upgrade guide, which is published within the next two months. This post focuses on whatβs new in Medusa 2.0. We will briefly cover the new architecture and commerce features, but otherwise, leave it to the documentation to educate about all the new concepts. Our documentation has also been rewritten and will, aside from tutorials, guides, and references, offer an in-depth learning path, equipping you with the knowledge needed to build bespoke commerce applications with Medusa.
Package restructuring
First, letβs understand the packages you need to build applications with Medusa 2.0. These havenβt changed much from 1.0, aside from some restructuring for a more logical separation of concerns.
There are three core packages in Medusa 2.0, and these are installed in new projects by default:
@medusajs/medusa
@medusajs/framework
@medusajs/admin-sdk
@medusajs/medusa
If you have been testing previews of Medusa 2.0, you know that weβve gone through a few iterations of package management to figure out the most appropriate bundling of our commerce features. Eventually, we decided to stick with what we had in Medusa 1.0, a single package containing all commerce modules and the Rest API. Much of this code ships as separate npm packages (more about this in the section covering our modular architecture). However, they are all dependencies of @medusajs/medusa
, which makes for a seamless upgrade path whenever new versions of underlying packages are published.
@medusajs/framework
We are excited to introduce a new package dedicated to our framework for customization. This package holds all the tooling needed to extend existing and/or introduce new functionality in Medusa projects. This includes API Routes, Workflows SDK, Modules SDK, Subscribers, Scheduled Jobs, Loaders, DML, and more. We will cover this in more depth in a later section.
@medusajs/admin-sdk
We have restructured our admin packages as part of the dashboard redesign. The commerce dashboard ships as @medusajs/dashboard
and is a dependency of the core package @medusajs/medusa
. The tooling to extend the dashboard, including UI Widgets and Routes, is now bundled in an Admin SDK package, @medusajs/admin-sdk
.
Now that you understand the new packages, letβs move on to the most significant change in Medusa 2.0.
Architecture rewrite
The largest change from Medusa 1.0 to 2.0 is the rewrite of our core architecture. While architecture rewrites often have a tarnished reputation, we believe this decision aligns with how software engineering will evolve in the next decade. We will elaborate on this thinking in a separate blog post.
Complete isolation of domains
In Medusa 2.0, all business domains (services and data models) have been rewritten from scratch to eliminate interdependencies between them. To understand the reasoning behind this change, letβs briefly consider the previous architectural design.
In Medusa 1.0, services, e.g., Product and Cart, held most cross-domain business logic, and relationships between data models were defined via foreign keys in the database. The Cart service strictly depended on the Product service for many operations, e.g., adding a line item to the cart, and the line item data model references product variants via foreign keys. This pattern was applied to all domains in Medusa 1.0, and made it near-impossible to partially adopt our feature offeringβit was all or nothingβa dealbreaker for some of our users, especially in the enterprise segment.
These interdependencies between domains significantly constrained the level of extensibility we could offer in the service layer. The only way to βextendβ services was to override entire methods, which led to nasty upgrade paths whenever we upgraded those service methods with additional logic.
Medusa 2.0 eliminates all interdependencies between domains. Services are now pure in the sense that they only manage resources within their domain. All cross-domain functionality has been moved to extensible workflows, which will be covered in a later section. Weβve also eliminated all database-level dependencies, removing foreign keys between data models in different modules.
Architecture of Medusa 2.0
Benefits of module isolation
Weβve already touched on some key benefits of module isolation. Over the past three years, weβve seen a growing demand for incremental adoption, especially from large businesses. These businesses often have a sizeable existing tech stack with various integrations and custom applications. For them, a full migration can take years and cost millions. They need a platform that allows them to migrate their tech stack gradually while keeping the existing systems intact. Our new modular architecture makes that possible (and feasible).
Gradual adoption of modules
A related benefit of module isolation is our new standalone mode. Not all companies need the full suite of features of a commerce platform. Weβve seen many requests for (and now usage of) standalone modules, which is a new βruntimeβ of modules in Medusa 2.0. Companies can install and use a few modules to build out their application. This is typically the preceding step to the gradual migration described above, where companies, over time, adopt more and more modules until they eventually leverage the full power of our platform.
For example, the Cart module can be used standalone to build a custom checkout flow:
import CartService from "@medusajs/cart"
const cart = await cartService.createCarts({
email: "[email protected]",
currency_code: "usd"
})
await cartService.addLineItem(cart.id. {
title: "Custom item",
unit_price: 1000,
quantity: 1
})
In a common setup, line items in a cart are associated with products. However, that might not be the case for your use case. You may sell simpler goods that are not tied to a product variant or calculated price. All you need is plug-and-play cart management, and we offer you precisely that.
Services as a lower-level primitive
A non-obvious benefit from our architecture rewrite is that services have become a more useful lower-level primitive. As described above, we've removed all cross-domain business logic from services, limiting them to managing resources within their modules. So, when you use the Cart service to create a cart, you only create a cart. This sounds obvious, but in monolithic architectures, itβs common to carry out cross-domain operations within single service methods. For example, you might create shipping methods or populate the region as part of creating the cart. Such actions are typically achieved via dependency injection, which, in Medusa 2.0, is not available across modules.
Having more βdumbβ services enables a greater level of composability. Modules can integrate more seamlessly, and how you integrate them is entirely up to you and your use case. Consider our previous example. Imagine you're not selling traditional products but rather subscriptions or licenses. Our Cart service doesnβt care. As long as you provide the required details to create line items, the Cart service and all its related functions, including total computation, will work as expected. It will also continue to work seamlessly with other modules, e.g. you can apply promotions to your license products with little to no changes needed. This is an example of the power of services as lower-level primitives and elegant abstractions.
Read more about the architectural changes in our documentation.
New and improved commerce features
As part of rewriting our commerce modules, we reevaluated each feature set to identify improvements. This led to various updates and new modules we are excited to introduce today.
Promotions engine
Our new Promotion module, @medusajs/promotion
, lets you set up advanced conditional promotion logic. You can compute discounts based on coupons, cart items, customers, or custom data models. Additionally, weβve introduced new types of promotions, such as Buy X and Get Y promotions.
Read more about the Promotions module here.
Advanced inventory management
Our new Inventory and Stock Location modules, @medusajs/inventory
and @medusajs/stock-location
, significantly improve inventory management in Medusa. With our Stock Location module, you can keep inventory in multiple warehouses worldwide, including physical stores, and associate those locations with shipping zones to ensure your fulfillment processes are optimized for distance to customers. With our new Inventory module, your product variants can share inventory items, enabling new use cases such as product bundl...
Medusa 2.0 Release Candidate #7
Get started with a new project
To get started using the RC, run the following command:
npx create-medusa-app@rc
This command will create a new Medusa project with our redesigned admin and a 2.0-compatible Next.js storefront. The Medusa application and the Next.js storefront are separate projects in separate folders.
Update existing project
Ensure your Medusa dependencies in package.json
are using the rc
tag:
{
"dependencies": {
"@medusajs/admin-sdk": "rc",
"@medusajs/framework": "rc",
"@medusajs/medusa": "rc",
"@medusajs/medusa-cli": "rc",
...
}
}
To ensure an upgrade to a new version is completed correctly, run the following sequence of commands:
rm -rf node_modules
rm yarn.lock // or package-lock.json
yarn // If you are using yarn berry, you need to create the lock-file first
Highlights
Package restructuring
Warning
Breaking change
This release comes with the final package restructuring, mainly dealing with consistent package names.
The following packages have been renamed:
@medusajs/medusa-cli
->@medusajs/cli
@medusajs/stock-location-next
->@medusajs/stock-location
@medusajs/inventory-next
->@medusajs/inventory
@medusajs/file-local-next
->@medusajs/file-local
medusa-telemetry
->@medusajs/telemetry
medusa-test-utils
->@medusajs/test-utils
This is a breaking change, and to upgrade, please update your dependencies as follows:
- Replace
medusa-test-utils
with@medusajs/test-utils
in your project - Replace
@medusajs/medusa-cli
with@medusajs/cli
in your project
Standardize provider ID generation
Warning
Breaking change
We have cleaned up some inconsistencies and legacy code in the provider domain, which has led to breaking changes.
- Module providers should no longer have a static property
PROVIDER
β this has been replaced withidentifier
- Module providers should have a static property
identifier
describing the name of the provider - Module providers' container registration name have changed format
Before
const key = `pp_[PROVIDER]_[id]`
id
being the id specified in the module provider configuration inmedusa-config.js
PROVIDER
being the property described above, that has now been removed
After
const key = `pp_[identifier]_[id]`
id
being the id specified in the module provider configuration inmedusa-config.js
- If this is not specified, we omit it from the registration key*
identifier
being the property described above, that replacedPROVIDER
*Previously, we did not omit the id
if it wasn't specified, which meant registration keys contained undefined
. For example:
pp_stripe-ideal_undefined
Aside from having a new name in the dependency container, these changes will also affect the payment providers stored in the database. They are stored using the registration key described above, so consequently, they will be loaded anew the first time you boot up your application after upgrading to this version.
Let's consider an example provider configuration of Stripe with an explicit id
:
{
id: "stripe-usd",
resolve: "@medusajs/payment-stripe",
options: { ... }
}
If Stripe providers were enabled, they used to be stored with the following IDs in the database:
pp_stripe_stripe-usd
pp_stripe-ideal_stripe-usd
pp_stripe-bancontact_stripe-usd
...
Those IDs will now be:
pp_stripe_stripe-usd
pp_stripe-ideal_stripe-usd
pp_stripe-bancontact_stripe-usd
...
Let's consider an example provider configuration of Stripe without an explicit id
:
{
resolve: "@medusajs/payment-stripe",
options: { ... }
}
If Stripe providers were enabled, they used to be stored with the following IDs in the database:
pp_stripe_undefined
pp_stripe-ideal_undefined
pp_stripe-bancontact_undefined
...
Those IDs will now be:
pp_stripe
pp_stripe-ideal
pp_stripe-bancontact
...
These changes will affect all created payment sessions on carts, as the provider specified upon creation no longer exists.
Form submission in Admin
Form submissions in Admin now require CMD + Enter
on MacOS or CTRL + Enter
on Windows. This makes for a more intentional action and prevents incorrect submissions.
Features
- breaking: rename package names to be consistent and under @medusajs scope by @thetutlage in #9580
- feat(core-flows): cart events by @carlos-r-l-rodrigues in #9585
- feat(dashboard): Submit forms on Cmd + Enter by @kasperkristensen in #9623
- feat(core-flows,types,medusa): Add tax region update API by @riqwan in #9634
- fea(providers): locking postgres by @carlos-r-l-rodrigues in #9545
- feat(medusa): ordem items endpoint by @carlos-r-l-rodrigues in #9646
- feat: allow html content for notifications by @christiananese in #9613
- feature: use application logger to log HTTP requests by @thetutlage in #9655
- feat(dashboard) taxes + discount breakdown by @fPolic in #9586
Bugs
- fix(dashboard): Set correct method value on promotion by @riqwan in #9610
- fix(dashboard): FF return reason table by @fPolic in #9614
- fix(utils): Mikro orm joined selection issue when select-in strategy by @adrien2p in #9615
- fix(modules-sdk): Add missing paths to require.resolve in load resources by @adrien2p in #9608
- fix(product): options validation if ids are same by @fPolic in #9622
- fix(dashboard,ui): Fix outline flash on FocusModal by @kasperkristensen in #9624
- fix: Add free text search on reservations by @olivermrbl in #9621
- fix(dashboard): cleanup Payments section by @fPolic in #9520
- fix(dashboard): Fix styling of nested NavLinks by @kasperkristensen in #9637
- fix(dashboard): Ensure all progress tabs are 200px wide by @kasperkristensen in #9644
- fix(ui): Fix Avatar styling by @kasperkristensen in #9645
- fix(core-flows, types): general fixes to types and tsdocs by @shahednasser in #9633
- fix(types): change options to be required in http type by @shahednasser in #9642
- fix(dashboard): Hide usage insights by @kasperkristensen in #9651
- test(admin-vite-plugin): React Invalid hook call on Windows by @kasperkristensen in #9647
- Fix/production logging by @thetutlage in #9658
- fix(orchestration): local workflow proxy by @carlos-r-l-rodrigues in #9664
- fix: resolve paths using require.resolve by @thetutlage in #9665
Documentation
- docs: added examples page by @shahednasser in #9587
- docs: improved commerce modules [5/5] by @shahednasser in #9592
- docs: fix heroku typo by @shahednasser in #9382
- docs: update providers to use ModuleProvider by @shahednasser in #9579
- Switch the headings to match the content by @erickirt in #9619
- fix(docs): update workflow API example to include query parameter by @VrajPatelK in #9640
- docs: update curl request to /admin/products by @shahednasser in #9641
- docs-util: add configuration to generate js-sdk reference by @shahednasser in #9630
- docs: add routing page by @shahednasser in #9550
- docs: document JS SDK installation by @shahednasser in #9611
Chores
- chore(medusa): default endpoints size limit by @carlos-r-l-rodrigues in #9616
- chore: Prepare changeset for 2.0 release by @olivermrbl in #9631
- feat(medusa): Display admin url on start by @adrien2p in #9643
- chore(js-sdk): add ignore tsdoc tag to client and constructor of inner classes by @shahednasser in #9635
- chore: remove internal module resources option by @carlos-r-l-rodrigues in #9582
- chore: Update modules providers configuration with 'identifier' and 'PROVIDER' by @adrien2p in #9636
New Contributors
- @VrajPatelK made their first contribution in #9640
Full Changelog: v2.0.0-rc.6...v2.0.0-rc.7
Medusa Release Candidate #6
Get started with a new project
To get started using the RC, run the following command:
npx create-medusa-app@rc
This command will create a new Medusa project with our redesigned admin and a 2.0-compatible Next.js storefront. The Medusa application and the Next.js storefront are separate projects in separate folders.
Update existing project
Ensure your Medusa dependencies in package.json
are using the rc
tag:
{
"dependencies": {
"@medusajs/admin-sdk": "rc",
"@medusajs/framework": "rc",
"@medusajs/medusa": "rc",
"@medusajs/medusa-cli": "rc",
...
}
}
To ensure an upgrade to a new version is completed correctly, run the following sequence of commands:
rm -rf node_modules
rm yarn.lock // or package-lock.json
yarn // If you are using yarn berry, you need to create the lock-file first
Highlight
Resolved issue with module provider loading
See #9601 for more.
Bugs
- fix(admin-vite-plugin): Replace slashes for Windows by @kasperkristensen in #9602
- fix: resolve provider path before requiring it by @thetutlage in #9601
- fix(types): logger by @carlos-r-l-rodrigues in #9581
Documentation
- docs: fix package names in module registration by @shahednasser in #9590
- docs: update resolve path to use src by @shahednasser in #9605
- docs-util: fixes for OAS docs generator + framework typedoc config by @shahednasser in
Full Changelog: v2.0.0-rc.5...v2.0.0-rc.6
Medusa Release Candidate #5
Get started with a new project
To get started using the RC, run the following command:
npx create-medusa-app@rc
This command will create a new Medusa project with our redesigned admin and a 2.0-compatible Next.js storefront. The Medusa application and the Next.js storefront are separate projects in separate folders.
Update existing project
Ensure your Medusa dependencies in package.json
are using the rc
tag:
{
"dependencies": {
"@medusajs/admin-sdk": "rc",
"@medusajs/framework": "rc",
"@medusajs/medusa": "rc",
"@medusajs/medusa-cli": "rc",
...
}
}
To ensure an upgrade to a new version is completed correctly, run the following sequence of commands:
rm -rf node_modules
rm yarn.lock // or package-lock.json
yarn // If you are using yarn berry, you need to create the lock-file first
Highlights
Removing ourDir
from admin settings
Warning
Breaking change
The outDir
has been removed in favor of internally computing output directory for the admin dashboard.
The computation follows these rules
- If admin is not
disabled
and thebuild
command is run without the--admin-only
flag, the admin output directory will be.medusa/server/public/admin
and it will be served from that same location from the Medusa instance. - If admin is not
disabled
and thebuild
command is run with the--admin-only
flag, then the admin output directory will be.medusa/admin
. This commands should be used for deploying the admin dashboard separately from the Medusa instance.
// medusa-config.ts
{
// ...
admin: {
- outDir: 'some/path'
}
}
Features
- chore: add compare_at_unit_price when price list price is retrieved by @riqwan in #9564
- feat(providers): locking redis by @carlos-r-l-rodrigues in #9544
Bugs
- fix(create-medusa-app): use db:migrate to run migrations by @shahednasser in #9565
- fix(core-flows, link-module): product <> inventory delete cascades by @fPolic in #9528
- fix: remove default value for the cluster flag by @thetutlage in #9570
- fix(dashboard): reservation inventory details by @fPolic in #9535
- feat(core-flows, product): options checks on product create/update by @fPolic in #9171
- fix(utils): update medusa config resolution for consistency by @adrien2p in #9591
- fix(utils): Reversed module package missing references by @adrien2p in #9589
- fix(admin-vite-plugin): Normalize file paths and add tests by @kasperkristensen in #9595
Chores
- chore: update slack message by @riqwan in #9290
- chore: Remove Query Filter by @adrien2p in #9403
- chore: Update admin build/serve configuration by @adrien2p in #9584
Full Changelog: v2.0.0-rc.4...v2.0.0-rc.5