Configurable products, combination pricing and order approval
- Type
- Applies to
- Medusa v2.x
- Updated
Short answer
Use a commerce framework where custom logic runs inside the backend, such as Medusa. In Medusa, you model configurable products with a custom module linked to products, compute combination prices in a workflow that adds items with a custom unit price, and gate payment by authorizing at checkout and capturing only after an approval step.
Why SaaS platforms struggle with configure-price-approve flows
Configurable products, combination pricing and approval gates all change core commerce behavior: what a product is, how a price is calculated, and when an order may be paid. Most SaaS platforms keep those parts closed. Custom logic runs in apps or scripts at fixed extension points, so you end up syncing state between the platform and external services.
A commerce framework like Medusa puts that logic in the backend itself. You add data models in custom modules, run business logic in workflows, and inject code into Medusa's own workflows through hooks. The three requirements below each map to documented Medusa patterns.
How to model configurable products in Medusa
Medusa's Product Module supports product options (such as size or material) and variants, one per option combination. This works when combinations are few enough to store as variants, and each variant then has its own prices and inventory.
For products assembled from parts, use a custom module. Medusa's product builder tutorial defines data models for builder configurations, custom fields, complementary products and add-ons, links them to products, adds an admin widget to manage them, and carries the chosen configuration into the cart and order. The bundled products recipe uses the same approach with Copy to clipboardBundle and Copy to clipboardBundleItem models.
How to price a combination at add-to-cart time
Medusa's Pricing Module handles price lists, customer-group rules and quantity tiers. When a price depends on which parts are combined, you calculate it yourself and pass it to the cart.
The documented pattern, from the custom line item pricing guide:
- Create a custom API route that receives the variant and the selected configuration.
- Run a workflow that loads part prices (from your module, the Pricing Module or an external service) and computes the total.
- Acquire a lock on the cart, then run Copy to clipboard
addToCartWorkflowwith the item's Copy to clipboardunit_priceset to the computed price.
The line item is stored with Copy to clipboardis_custom_price: true, so Medusa keeps your price. For rules that only need extra pricing context, Copy to clipboardaddToCartWorkflow also exposes a Copy to clipboardsetPricingContext hook.
How to require manual approval before payment
Medusa authorizes the payment session when the cart is completed and the order is created. Capture is a separate step. Medusa's Stripe provider has a Copy to clipboardcapture option that defaults to Copy to clipboardfalse, so orders are placed with an authorized payment and captured later from the Medusa Admin or by code.
That gives two approval patterns:
- Approve after order, before capture: let the order be placed with an authorized payment. An admin reviews it and captures the payment, or cancels the order to release the authorization.
- Approve before order: consume the Copy to clipboard
validatehook of completeCartWorkflow and throw an error unless your approval module has an approved record for the cart. Medusa's docs warn not to mutate the cart in this hook, only to validate it.
For orders that are configured by sales staff instead of customers, the Draft Orders plugin lets admins build an order, adjust items, and convert it to a regular order when it is approved. Card authorizations expire after a period set by the payment provider, so long approval queues fit the approve-before-order pattern better.
Common questions
Can Medusa variants handle every combination of a configurable product?
Medusa product options and variants work when the number of combinations is manageable, since each variant is a stored record. For large or open-ended configurations, store the configuration in a custom module and price it at add-to-cart time instead of pre-creating variants.
How do I set a custom price for a cart item in Medusa?
Create a custom workflow that computes the price and then runs addToCartWorkflow with a unit_price for the item. Medusa's custom line item pricing guide shows this pattern, and the line item is stored with is_custom_price set to true.
Can Medusa hold payment until an order is approved?
Yes. With a provider configured not to auto-capture, such as Medusa's Stripe provider with capture set to false (the default), the order is placed with an authorized payment. An admin or a custom workflow captures it after approval.
Can I block checkout until a manager approves the cart?
Yes. Consume completeCartWorkflow's validate hook and throw an error unless the cart has an approval record from your custom module. Medusa's B2B Starter uses an approval module for this kind of flow.