Skip to content

Medusa.js field notes

Fix Medusa storefront, pricing, inventory, orders, and workflows with a script

A working library of the problems that hit real Medusa.js (v2) stores, across storefront access, regions and pricing, inventory and stock, cart and checkout, orders and fulfillment, promotions, module links, and background jobs, and how to detect or repair each one with a small Python or Node.js script on the Medusa Admin API. Every guide has a diagram of the problem, a diagram of the fix, full code in both languages, tests, and links to the source docs.

Python and Node.js Medusa Admin API Diagrams and full code
Browse all 88 scripts on GitHub Download them all as a zip Field guide PDF (88 fixs, 167 KB) Follow @allanninal Every fix on this page has a tested Python and Node.js script in the repo. Free, and MIT as stated in its README.

Storefront and API access

3 guides

Regions, pricing, and currency

4 guides

Inventory and stock

5 guides

Cart and checkout

4 guides

Orders and fulfillment

4 guides

Promotions and campaigns

3 guides

Modules, links, and data

5 guides

Events, workflows, and jobs

4 guides

Migration and housekeeping

2 guides

Customer & Auth

4 guides

Inventory & Reservations

7 guides

Stock Locations & Sales Channels

3 guides

Payments & Refunds

8 guides

Custom provider capture skips creating the order transaction

A provider returning captured status never creates the order transaction, so paid_total stays wrong; script recomputes paid_total from provider records.

Repair

Outstanding amount does not update after the first refund

Only the first refund updates outstanding_amount, letting later refunds repeat the same amount unnoticed; script diffs summary against real provider refunds.

Diagnostic

Custom provider capture leaves outstanding amount desynced

After a custom provider capture, outstanding_amount and paid_total drift from actual payments, corrupting later refunds; script recalculates and flags drift.

Diagnostic

Refund rejected on a captured order showing zero outstanding

The refund API blocks valid refunds citing no outstanding balance even though the payment was fully captured; script flags and issues the refund directly.

Repair

Only one refund per order or payment ever succeeds

Later refund attempts silently fail after the first, leaving refunded total below what admin recorded; script sums refund transactions against the order total.

Diagnostic

Sub-cent rounding mislabels a paid order as partially captured

A rounding gap under one cent between collection and captured amount flags fully paid orders as partially_captured; script recomputes and clears near-zero deltas.

Repair

New payment collection ignores amounts already captured

After a price edit, a new payment collection shows the full new total instead of the remaining outstanding balance; script recomputes outstanding and reconciles.

Reconciler

Stripe capture succeeds but no Medusa order is created

Funds are captured in Stripe but the cart never completes to an order due to a webhook race; script reconciles Stripe charges against Medusa orders.

Reconciler

Order Edits & Totals

5 guides

Fulfillment & Returns

3 guides

Pricing & Promotions

9 guides

Buy X get Y promotions fail to apply during cart updates

Buyget type promotions do not apply in the update cart promotions workflow even when conditions are met; script re-evaluates rules against cart contents.

Diagnostic

Campaign budget usage never increments for Buy X Get Y

Redeeming a buy X get Y promotion does not update the campaign budget's used counter, letting spend exceed budget; script recomputes usage from applied orders.

Reconciler

Promotion ignores its sales channel condition and applies anyway

A promotion scoped to one sales channel applies store wide regardless of the cart's channel; script checks applied promotions against cart.sales_channel_id.

Diagnostic

Shipping discount uses a stale shipping amount after cart changes

Percentage off shipping promotions keep discounting an outdated shipping total when cart items change; script recomputes the promo against the current total.

Reconciler

Draft orders reject valid promotion codes

Applying a promotion code to a draft order fails even though the same code works on a regular cart; script applies the code via API and flags rejections.

Diagnostic

A price list suppresses all default variant prices once active

calculated_price ignores default prices entirely once any price list exists, hiding correct fallback pricing; script compares default vs calculated price.

Diagnostic

Price list keeps serving prices past its end date

Storefront keeps charging an expired price list price after end_date passes; script flags price lists with a past end date still returned by calculated_price.

Diagnostic

Multiple customer group membership breaks price list resolution

Customers belonging to more than one group get the default price instead of their group's price list override; script checks quoted price per test customer.

Diagnostic

Region scoped price ignored in favor of currency only price

A price explicitly scoped to a region_id is skipped for a currency only price, causing the wrong charge amount; script cross checks price rules vs served price.

Diagnostic

Workflows & Background Jobs

5 guides

Events & Notifications

3 guides

Module Links & Migrations

3 guides

Catalog Import

4 guides

Fighting a Medusa bug right now?

If you have a problem in Medusa storefront access, pricing, inventory, orders, promotions, or workflows that you would rather hand off, this is the kind of work I do. Message me and we can work through it together.

Contact me on LinkedIn

Found this useful?

These guides are free and always will be. If one saved you a support ticket or a refund, you can throw a coffee my way. It keeps the notes coming.

Buy me a coffee on Ko-fi