---
title: "Implement Product Rentals in Medusa"
description: "Learn how to support product rentals in your Medusa commerce store, with full admin and storefront customizations."
url: https://medusajs.com/blog/product-rentals
last_updated: 2026-08-13T13:30:24Z
---

# Implement Product Rentals in Medusa

_Published 2025-11-04 by Shahed  Nasser in Product_

Product rentals allow customers to rent products for a specified period. In this tutorial, you’ll learn how to enable product rentals in your Medusa store. This feature is particularly useful for businesses that offer rentals for items such as vehicles, gadgets, and formal wear.

Medusa is a digital commerce platform with a built-in framework for customization. It is an ideal solution for implementing custom commerce applications and unique product cases like product rentals. Medusa allows this by letting developers create custom data models and business logic on top of existing features, as well as to inject custom logic into existing commerce workflows.

> **Implement Product Rentals in Medusa**
> Follow this step-by-step guide
>
> [Get Started](https://docs.medusajs.com/resources/how-to-tutorials/tutorials/product-rentals)

## Create Product Rental Data Models

To manage and store rental-related data, you’ll need to create a Rental Module that defines the data models for rental configurations and customer rentals. The module’s service should handle data management operations for these models.

You can then link your custom data models with Medusa’s existing ones (as defined in [Commerce Modules](https://docs.medusajs.com/resources/commerce-modules)) to extend core features. For example, you can associate a rental configuration with a product, and a rental record with an order.

![](https://assets.medusajs.com/uploads/2025/11/some-graphics-2025-rentals-summary-xwaqm0ct.webp)

## Manage Product Rental Configurations

You can extend the Medusa Admin dashboard to add a rental section for products. From there, admin users can specify whether a product is available for rent and configure options such as minimum and maximum rental durations.

## Validate Rental Options

In the Next.js Starter Storefront, you can customize the product page to allow customers to select a rental period.

When a customer chooses a rental period, you can validate in the backend whether that rental period is available for the item. This validation also occurs when a rental product is added to the cart and when the customer places an order.

![](https://assets.medusajs.com/uploads/2025/11/rental-validation-ney9yohl.webp)

## Handle Order Events

Admin users can perform operations on orders, such as canceling them or creating fulfillments for rented items.

You can inject custom validation logic into the workflow that handles order cancellations, preventing admin users from canceling orders when rentals have already been returned.

```typescript
import { cancelOrderWorkflow } from "@medusajs/medusa/core-flows"
import { MedusaError, ContainerRegistrationKeys } from "@medusajs/framework/utils"

cancelOrderWorkflow.hooks.orderCanceled(
  async ({ order }, { container }) => {
    const query = container.resolve(ContainerRegistrationKeys.QUERY)

    const { data: rentals } = await query.graph({
      entity: "rental",
      fields: ["id", "status", "variant_id"],
      filters: {
        order_id: order.id,
      },
    })

    const nonCancelableRentals = rentals.filter(
      (rental: any) => !["pending", "active", "cancelled"].includes(rental.status)
    )

    if (nonCancelableRentals.length > 0) {
      throw new MedusaError(
        MedusaError.Types.NOT_ALLOWED,
        `Cannot cancel order.`
      )
    }
  }
)
```

Then, you can create a subscriber that automatically and asynchronously cancels rentals when an order is canceled.

```typescript
export default async function orderCanceledHandler({
  event: { data },
  container,
}) {
  const query = container.resolve("query")

  const { data: rentals } = await query.graph({
      entity: "rental",
      fields: ["id", "status"],
      filters: {
        order_id: data.id,
        status: {
          $ne: "cancelled",
        }
      },
    })

    for (const rental of rentals) {
      await updateRentalWorkflow(container).run({
        input: {
          rental_id: (rental as any).id,
          status: "cancelled",
        },
      })
    }
}

export const config: SubscriberConfig = {
  event: "order.canceled",
}
```

## Tutorial: Implement Product Rentals in Medusa

By following [this tutorial](https://docs.medusajs.com/resources/how-to-tutorials/tutorials/product-rentals) in our documentation, you’ll learn how to:

- Create a Rental Module with data models for rentals and rental configurations.
- Enable admin users to manage rental configurations in the Medusa Admin.
- Allow customers to select rental periods in the storefront.
- Let admin users manage rentals within orders.
- Handle order events, such as cancellations.

The tutorial also includes guidance for specific use cases, such as removing shipping requirements or managing inventory.
