Magento 2 and Adobe Commerce field notes
Fix Magento indexing, cron, MSI stock, and order grids with a script
A working library of the problems that hit real Magento 2 and Adobe Commerce stores, across indexing, cron, MSI multi source inventory, orders and grid sync, catalog and prices, and customers, and how to detect or repair each one with a small Python or Node.js script. Every guide has a diagram of the problem, a diagram of the fix, full code in both languages, tests, and links to the source reports.
Indexing
8 guidesStale price index shows wrong or old prices
Storefront price lags admin price after edits or rule changes. Script diffs API price vs price index and triggers reindex.
soonIndexer stuck at reindex required or processing
A crashed or killed reindex leaves indexer_state locked forever. Script polls indexer status and flags or resets stuck rows.
soonProducts vanish mid reindex on delete then insert cycle
catalog_product_index_price briefly drops rows during rebuild, hiding products. Script compares product counts before and after reindex.
soonProducts flap out of category or search during scheduled indexing
Mview delete and recreate cycle temporarily empties catalogsearch results. Script polls category and search endpoints during reindex windows.
soonCategory product assignment changes do not reach search index
catalog_category_product edits never flow into the fulltext changelog, hiding newly assigned products. Script compares category API assignment vs storefront listing.
soonCategory product count wrong or zero on large catalogs
Reported category product count diverges from real assignments due to a temp table bug. Script compares actual assignments vs reported count via API.
soonAnchor category shows products from disabled subcategories
is_anchor categories leak products from disabled child categories into storefront listings. Script cross-checks category status vs indexed product assignment.
soonCatalog price rule cron failure blocks downstream indexers
catalogrule_apply_all failing on a new store view halts scheduled indexers, leaving rule prices unapplied. Script compares catalog rule price vs expected discount via API.
soonCron
4 guidesCron jobs stuck in running state block all future runs
A crashed job leaves cron_schedule status as running forever, starving the job code. Script queries cron_schedule for stale running rows past a timeout.
soonCron generation halts entirely after a crash
After one crashed run, cron stops scheduling new jobs for that code. Script checks last run timestamp per job against expected frequency.
sooncron_schedule fills with duplicate pending jobs
Duplicate pending rows for the same job pile up and delay real work. Script counts duplicate pending schedules per job code and prunes them.
soonOrder confirmation emails silently stop sending
Async sales email depends on cron; if cron is dead, order emails never go out though orders succeed. Script checks cron health against an unsent email queue.
soonInventory (MSI)
9 guidesSalable quantity corrupted by bad reservation compensation
Lost, duplicated, or overcompensated reservations desync salable qty from real stock. Script sums reservations vs source qty per SKU and reconciles.
soonSalable quantity goes negative or allows oversell
Concurrent checkout or bad backorder config lets salable qty drop below zero. Script cross-checks source_items, reservations, and open orders for negative stock.
soonProduct shows in stock while salable quantity is zero
Stock status flag disagrees with computed salable qty of zero, letting shoppers order phantom stock. Script compares stock item status vs salable quantity API.
soonListing page and product page disagree on stock status
Category grid shows in stock while the product page shows out of stock for the same SKU at zero qty. Script diffs stock status across grid and detail endpoints.
soonShared stock not synced across websites
A purchase in one website does not decrement salable qty for sibling websites sharing the same stock, causing oversell. Script compares salable totals per website for a stock id.
soonConfigurable parent stock status not derived from children
Parent configurable stays stale or wrong after child simple product qty changes, sometimes showing in stock when all children are out. Script recomputes parent status from children via API.
soonOut of stock threshold change not applied to existing items
Changing the out of stock threshold does not recompute status for existing source items. Script recalculates is_in_stock per source item against the new threshold.
soonNegative source item quantity still counted as positive stock
An out of stock source with negative qty still adds positively to combined salable quantity. Script sums source_items per SKU and flags impossible totals.
soonREST created orders skip reservation placement
Orders placed through the order create API bypass the reservation plugin, leaving salable qty stale. Script compares order items against the reservations table.
soonOrders and Grid Sync
5 guidesSales order grid permanently out of sync with sales_order
Async grid indexing watermark race or crash leaves orders missing or stale in the admin grid. Script diffs order ids and status between the entity API and grid API.
soonGrid refresh by schedule caps at batch size, backlog grows
Scheduled grid refresh only processes one batch per run so unsynced orders pile up. Script counts pending sync rows and triggers repeated refresh.
soonDuplicate or colliding order increment id
Two orders share the same increment id after migration or store padding differences, breaking lookups and ERP sync. Script scans orders for duplicate increment id values.
soonOrder sequence drifts from auto increment after migration
The sequence table falls out of sync with the underlying auto increment, causing repeated or gapped order numbers. Script compares max increment id vs sequence value.
soonReserved order ids create unexplained numbering gaps
Abandoned quotes reserve an increment id that is never consumed, looking like lost orders. Script correlates quote reserved_order_id against placed orders.
soonOrders and Payments
3 guidesOrder stuck on pending payment after invoice is paid
Invoice or gateway shows paid but order state never transitions to processing. Script fetches order and invoice status via API and flags the mismatch.
soonOrder closed prematurely while invoice is still pending
Creating a shipment flips the order to closed even though the invoice has not been paid. Script cross-checks order status vs invoice state on shipped orders.
soonOrder stuck in payment review with no way out
A gateway review flag freezes the order state indefinitely with no cancel path. Script finds orders in payment review older than a threshold and forces cancel or recheck.
soonCredit Memos and Refunds
7 guidesCredit memo total wrong on multi invoice orders
Refund total or tax is miscalculated when an order was split across multiple invoices. Script recomputes expected refund from invoice and tax data and compares to the credit memo.
soonPartial refund tax computed from full order instead of refunded items
Partial credit memos pull total order tax rather than a proportional share. Script recomputes expected tax and compares to the credit memo record.
soonDuplicate credit memo created for one refund action
A single refund action produces more than one credit memo record. Script lists credit memos per order id and flags extras.
soonOrder status wrong after partial or zero total refund
A partial or zero total credit memo leaves the order at Complete or Processing instead of Closed. Script checks credit memo totals against order status.
soonCredit memo grand total not refreshed after adjustment edit
Editing refund shipping or adjustment fields does not refresh the credit memo grand total in the API response. Script recomputes expected total from line items and flags drift.
soonOnline refund silently falls back to offline
A REST created credit memo fails to load the invoice instance so the gateway is never charged the refund. Script checks the credit memo online flag and transaction id against the request.
soonManual invoice missing tax leaves false amount due
Admin created invoices omit tax amount so total paid understates and the order shows a balance due. Script sums invoices vs order grand total via API.
soonShipments
1 guidesShipment tracking number dropped when created via API
A shipment created through the ship endpoint saves without its tracking number attached. Script creates or reads shipments and checks the tracks collection for the missing entry.
soonURL Rewrites
5 guidesDuplicate or orphaned url_rewrite rows cause 404s
Migration or bulk edits leave duplicate or stale url_rewrite entries pointing nowhere. Script fetches URL keys via API and diffs against url_rewrite records.
soonProduct URL fails when rewrite generation is disabled with empty suffix
Disabling category and product rewrite generation combined with an empty suffix causes 404 or 500 on product pages. Script checks SEO config flags against live product URL responses.
soonURL rewrites not generated on product edit or duplicate
Editing or duplicating a product silently skips rewrite generation, causing 404s. Script fetches the product then checks the url rewrite endpoint for a match.
soonDisabling rewrite setting still creates duplicate rewrites
Setting category and product rewrite generation to no still yields two rewrite paths per product. Script lists url_rewrite entries per product id looking for duplicates.
soonDuplicate url key blocks product resave after migration
A collision error blocks edits when two products end up with the same request path after a platform migration. Script finds colliding request path rows and dedupes them.
soonCatalog and Visibility
6 guidesEnabled product missing from storefront
Product has active status but wrong visibility, website assignment, or stale index keeps it off the storefront. Script checks status, visibility, website assignment, and category link via API against storefront presence.
soonProduct silently reassigned to the wrong store on save
Products lose their website assignment and get force assigned to the default store after a save. Script audits website ids via API against the expected mapping.
soonImported products missing website assignment
Products save via import or API but get no website assignment row, so they never render on the storefront. Script lists products via API and checks for empty website ids.
soonDuplicate SKU created through concurrent API or import saves
A race condition during concurrent product saves creates two entities effectively duplicating one SKU. Script queries products by SKU for entity id collisions.
soonConfigurable parent has no image while children do
The parent configurable lacks its own gallery entry so its image is blank though variants have images. Script fetches child media gallery entries via API and flags parents with zero images.
soonProduct images duplicated on repeated import or product duplication
Re-importing the same CSV or duplicating a product re-adds identical images to the gallery each run. Script counts gallery entries per SKU and flags exact duplicate files.
soonPricing and Tax
6 guidesCatalog price rule discounts base price instead of group price
A rule scoped to one customer group discounts the original price rather than that group tier price, or applies outside its scope. Script compares rule applied price vs expected group price via API.
soonWrong tax or price shown per customer group at checkout
Mismatched tax class produces a different final price across customer groups for the same tier price. Script fetches price per customer group via API and compares to expected output.
soonTax rate wrong when shipping address differs from customer default
Order applies the customer default address tax class instead of the selected shipping address, over or under charging VAT. Script recomputes expected tax rule match per address and compares to applied tax.
soonTax recalculated incorrectly after coupon applied
Applying a discount coupon shifts the taxable base incorrectly so totals do not reconcile with price minus discount. Script recomputes tax from order items and discounts and diffs the result.
soonOrder tax off by rounding between calculation methods
Per item vs per row tax rounding produces a small drift from the expected total. Script recomputes expected tax and diffs against the order tax amount.
soonShared catalog price cached and served to the wrong company
The first viewer's discounted shared catalog price gets cached and served to guests or other companies on category pages. Script requests category prices as different customer groups and flags mismatches.
soonCart Price Rules and Coupons
3 guidesCoupon usage limit not enforced, allowing unlimited reuse
Uses per coupon or per customer limits fail to block extra redemptions because times_used never increments. Script counts orders per coupon and customer against configured limits.
soonCoupon marked used despite the order never completing
Usage is recorded even though the cart later fails minimum order validation and never converts to an order. Script reconciles coupon usage rows against actual placed orders.
soonAutomatic no coupon rule stops applying once a coupon rule exists
Adding a second coupon based rule silently disables an existing automatic no coupon rule. Script fetches active cart rules and simulates cart totals to detect non-application.
soonCustomers
1 guidesDuplicate customer accounts share one email across websites
Customer account share settings allow the same email to exist per website, causing ERP or sync conflicts. Script queries customers by email across websites for duplicates.
soonAPI and Integration
1 guidesAdmin or integration tokens expire and silently break automation
Hardcoded short lived admin tokens expire, causing scripted API calls to fail with unauthorized errors. Script detects 401 responses and auto refreshes via the integration OAuth token.
soonFighting a Magento 2 and Adobe Commerce bug right now?
If you have a problem in Magento indexing, cron, MSI stock, or order grid that you would rather hand off, this is the kind of work I do. Message me and we can work through it together.
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