- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
Personalized Products Recipe
This recipe provides the general steps to build personalized products in Medusa.
Overview#
Personalized products are products that customers can customize based on their need. For example, they can upload an image to print on a shirt or provide a message to include in a letter.
In Medusa, you create a custom module defining data models, implementing custom features, and creating relationships to other modules' data models.
You also have freedom in how you choose to implement the storefront, allowing you to build a unique experience around your products.
Store Personalized Data#
The Cart Module's LineItem
data model has a metadata
property that holds any custom data. You can pass the customer's customization in the request body's metadata
field when adding a product to the cart.
For example, if you’re asking customers to enter a message to put in a letter they’re purchasing, use the metadata
attribute of the LineItem
data model to set the personalized information entered by the customer:
metadata
attributes are not considered the same item. So, each line item is managed separately and can have its own quantity.In more complex cases, you can create a custom module that stores and manages the personalization data models. You can also create a relationship between these data models and the LineItem
data model.
Build a Custom Storefront#
Due to Medusa's modular architecture, there are no restrictions on the framework you use to build the storefront, or design and experience you provide customers. The storefront connects to the Medusa application using the Store API Routes.
You can build a unique experience around your products that focuses on the customer’s personalization capabilities.
Medusa provides a Next.js Starter storefront with basic ecommerce functionalities that can be customized. You can also build your own storefront and use Medusa’s client libraries or Store API Routes to communicate with the Medusa application.
Pass Personalized Data to the Order#
If you store the personalized data using a custom module:
- Create a custom API Route that handles saving the personalization data.
- Call that API Route from the storefront after adding the item to the cart.
- Listen to the
order.placed
event to attach the personalized data to the Order Module'sLineItem
data model.
Fulfill Personalized Products in Orders#
To fulfill your personalized products with a third-party service or custom logic, create a fulfillment module provider.
The Fulfillment Module registers your fulfillment module provider to use it to fulfill orders.