Skip to content

Conversation

@willbouch
Copy link
Contributor

@willbouch willbouch commented Oct 22, 2025

This is the SERVER-SIDE part of the PR. The client-side PR can be found here. To test via snapshot, it will be easier to fo it from the client-side PR, since it is based on this one.

WHAT
This PR handles an important and heavily requested redesign in the Core. For context, the relationship between Product and ProductOptions currently is 1-many. We want to change that to a many-many relationship, which will allow linking multiple Products to the same ProductOption. This will be useful to implement filters on the storefront for example.

HOW
Here is an image of the redesign:
CleanShot_2025-10-21_at_13 27 29

To clarify, the pivot table between product_option_value and the other pivot table will be used to enable linking only a subset of the ProdutOptionValues to a Product. For example, a ProductOption named Color could have 10 colors defined, and I might have a Product that only exists in 5 colors. In that case, to avoid making many Color options, the user will have the ability to only choose the colors they want for that product

In this PR, you will find:

  1. Brand new endpoints to interact with product options (CRUD)
  2. Endpoint to link options with products
  3. Modification to the product service to account for the modified relationship

I will leave comments in the PR to make the review a bit easier

WHAT IS LEFT
I decided to put the stuff I needed to have a "functional" frontend, but there are still things that are missing that I will address in another PR

  • The functionality to save a subset of the values

@changeset-bot
Copy link

changeset-bot bot commented Oct 22, 2025

🦋 Changeset detected

Latest commit: f32e5d3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 74 packages
Name Type
@medusajs/medusa Major
@medusajs/product Major
@medusajs/core-flows Major
@medusajs/types Major
@medusajs/test-utils Major
@medusajs/medusa-oas-cli Major
integration-tests-http Patch
@medusajs/draft-order Major
@medusajs/framework Major
@medusajs/js-sdk Major
@medusajs/modules-sdk Major
@medusajs/orchestration Major
@medusajs/utils Major
@medusajs/workflows-sdk Major
@medusajs/admin-bundler Major
@medusajs/dashboard Major
@medusajs/analytics Major
@medusajs/api-key Major
@medusajs/auth Major
@medusajs/caching Major
@medusajs/cart Major
@medusajs/currency Major
@medusajs/customer Major
@medusajs/file Major
@medusajs/fulfillment Major
@medusajs/index Major
@medusajs/inventory Major
@medusajs/link-modules Major
@medusajs/locking Major
@medusajs/notification Major
@medusajs/order Major
@medusajs/payment Major
@medusajs/pricing Major
@medusajs/promotion Major
@medusajs/region Major
@medusajs/sales-channel Major
@medusajs/settings Major
@medusajs/stock-location Major
@medusajs/store Major
@medusajs/tax Major
@medusajs/user Major
@medusajs/workflow-engine-inmemory Major
@medusajs/workflow-engine-redis Major
@medusajs/oas-github-ci Major
@medusajs/cache-inmemory Major
@medusajs/cache-redis Major
@medusajs/event-bus-local Major
@medusajs/event-bus-redis Major
@medusajs/analytics-local Major
@medusajs/analytics-posthog Major
@medusajs/auth-emailpass Major
@medusajs/auth-github Major
@medusajs/auth-google Major
@medusajs/caching-redis Major
@medusajs/file-local Major
@medusajs/file-s3 Major
@medusajs/fulfillment-manual Major
@medusajs/locking-postgres Major
@medusajs/locking-redis Major
@medusajs/notification-local Major
@medusajs/notification-sendgrid Major
@medusajs/payment-stripe Major
@medusajs/cli Major
@medusajs/deps Major
@medusajs/telemetry Major
@medusajs/admin-sdk Major
@medusajs/admin-shared Major
@medusajs/admin-vite-plugin Major
@medusajs/icons Major
@medusajs/toolbox Major
@medusajs/ui-preset Major
create-medusa-app Major
medusa-dev-cli Major
@medusajs/ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Oct 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

8 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
api-reference Ignored Ignored Nov 3, 2025 6:53pm
api-reference-v2 Ignored Ignored Preview Nov 3, 2025 6:53pm
cloud-docs Ignored Ignored Preview Nov 3, 2025 6:53pm
docs-ui Ignored Ignored Preview Nov 3, 2025 6:53pm
docs-v2 Ignored Ignored Preview Nov 3, 2025 6:53pm
medusa-docs Ignored Ignored Preview Nov 3, 2025 6:53pm
resources-docs Ignored Ignored Preview Nov 3, 2025 6:53pm
user-guide Ignored Ignored Preview Nov 3, 2025 6:53pm

@NicolasGorga
Copy link
Contributor

Hey Will, one thing i noticed is if the pivot entity is not defined between product and product option, additional columns can't be added to the pivot table, like for example the rank field, to be able to specify for a given product, the order you want its options to show.

@willbouch
Copy link
Contributor Author

Hey Will, one thing i noticed is if the pivot entity is not defined between product and product option, additional columns can't be added to the pivot table, like for example the rank field, to be able to specify for a given product, the order you want its options to show.

The rank field will be on product_option_value and also on the pivot table between product_option_value and product_option_option. Will take care of that later but you are right. I guess that I will have to create a model for the pivot table anyway, so will do it now

@willbouch willbouch changed the title chore(product,types): change relationship between product and option to many-to-many WIP chore(product,types): change relationship between product and option to many-to-many Oct 23, 2025
@willbouch willbouch changed the title WIP chore(product,types): change relationship between product and option to many-to-many WIP Oct 23, 2025
@willbouch willbouch changed the title WIP WIP - feat(): product options redesign (server-side) Oct 28, 2025
@willbouch willbouch changed the title WIP - feat(): product options redesign (server-side) WIP - feat(medusa,product,core-flows,types): product options redesign (server-side) Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants