Product Variant Inventory

In this guide, you'll learn about the inventory management features related to product variants.

Configure Inventory Management of Product Variants#

A product variant, represented by the ProductVariant data model, has a manage_inventory field that's disabled by default. This field indicates whether you'll manage the inventory quantity of the product variant.

The Product Module doesn't provide inventory-management features. Instead, the Medusa application uses the Inventory Module to manage inventory for products and variants. When manage_inventory is disabled, the Medusa application always considers the product variant to be in stock. This is useful if your product's variants aren't items that can be stocked, such as digital products, or they don't have a limited stock quantity.

When manage_inventory is enabled, the Medusa application tracks the inventory of the product variant using the Inventory Module. For example, when a customer purchases a product variant, the Medusa application decrements the stocked quantity of the product variant.


How the Medusa Application Manages Inventory#

When a product variant has manage_inventory enabled, the Medusa application creates an inventory item using the Inventory Module and links it to the product variant.

Diagram showcasing the link between a product variant and its inventory item

The inventory item has one or more locations, called inventory levels, that represent the stock quantity of the product variant at a specific location. This allows you to manage inventory across multiple warehouses, such as a warehouse in the US and another in Europe.

Diagram showcasing the link between a variant and its inventory item, and the inventory item's level.

TipLearn more about inventory concepts in the Inventory Module's documentation.

The Medusa application represents and manages stock locations using the Stock Location Module. It creates a read-only link between the InventoryLevel and StockLocation data models so that it can retrieve the stock location of an inventory level.

Diagram showcasing the read-only link between an inventory level and a stock location

TipLearn more about the Stock Location Module in the Stock Location Module's documentation.

Product Inventory in Storefronts#

When a storefront sends a request to the Medusa application, it must always pass a publishable API key in the request header. This API key specifies the sales channels, available through the Sales Channel Module, of the storefront.

The Medusa application links sales channels to stock locations, indicating the locations available for a specific sales channel. So, all inventory-related operations are scoped by the sales channel and its associated stock locations.

For example, the availability of a product variant is determined by the stocked_quantity of its inventory level at the stock location linked to the storefront's sales channel.

Diagram showcasing the overall relations between inventory, stock location, and sales channel concepts


Variant Back Orders#

Product variants have an allow_backorder field that's disabled by default. When enabled, the Medusa application allows customers to purchase the product variant even when it's out of stock. Use this when your product variant is available through on-demand or pre-order purchase.

TipYou can also allow customers to subscribe to restock notifications of a product variant as explained in this guide.

Additional Resources#

The following guides provide more details on inventory management in the Medusa application:

Was this page helpful?
Edit this page
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break