Skip to main content

Out-of-Stock Rules Engine

A product going briefly out of stock isn't an SEO problem. A product that's been OOS for two months is. The Rules Engine tracks days-OOS per product per store and applies a configurable action — noindex,follow, 301 redirect, or disable — once a threshold is crossed.

How it works

            ┌──────────────────────┐
│ Daily cron (03:00) │
└──────────┬───────────┘

┌─────────────────────────────────┐
│ 1. Track newly OOS products │ → Insert into byte8_seosuite_oos_tracking
└─────────────────────────────────┘

┌─────────────────────────────────┐
│ 2. Untrack restocked products │ → Delete row + revert noindex if applied
└─────────────────────────────────┘

┌─────────────────────────────────┐
│ 3. Apply action where │ → noindex / redirect / disable based on config
│ oos_since < (now - N days) │
└─────────────────────────────────┘

Cron byte8_seosuite_oos_rules runs at 0 3 * * *. Idempotent — re-running won't re-apply already-applied actions.

Three actions

ActionWhat it doesReversible?
noindexSets meta_robots = noindex,follow on the product✅ Auto-reverts when stock returns
redirectInserts a 301 in url_rewrite from product URL → primary category URL❌ Manual to undo
disableSets product status = disabled❌ Manual to undo

The noindex action is the safest — products that come back into stock have their meta_robots cleared automatically by the next cron run. The other two are destructive: choose them only when you're confident the SKU is permanently gone.

Configuration

Stores → Configuration → SEO Suite → Out-of-Stock Rules Engine

FieldDefault
Enable rules engineNo
Threshold (days OOS before action)30
Action when threshold exceedednoindex,follow
Fallback to home page when product has no categoryNo (only relevant for redirect action)

Per-store overrides supported.

Threshold guidance

  • 14 days — aggressive, for fast-moving fashion / seasonal catalogs
  • 30 days (default) — most retailers; gives ops time to restock before SEO action
  • 60+ days — slow-moving B2B / spare-parts catalogs where stock can be intermittent

Action guidance

  • noindex — default, reversible, low risk. Recommended starting point.
  • redirect — when you know the product is discontinued and want to capture the SEO traffic on a related category page
  • disable — for catalog hygiene at scale (admin teams that want OOS-for-N-days products to disappear from the storefront entirely)

Manual override per row

Some SKUs are intentionally OOS — pre-orders, seasonal staples, signal products. Toggle Manual override = Yes on the row in Marketing → SEO Suite → Out-of-Stock Tracking and the cron will skip it forever (until you toggle it off).

Admin grid

Marketing → SEO Suite → Out-of-Stock Tracking

ColumnNotes
Product ID, SKUSnapshot at first track-time so deleted products still display sensibly
StorePer-store row — same product OOS in 2 stores = 2 rows
OOS sinceWhen the product first went out of stock (per this store)
Action appliednoindex / redirect / disable once cron fires post-threshold
Action applied atTimestamp of action
Manual overrideIf Yes, cron skips this row
UpdatedLast cron-touched timestamp

Toolbar: Run Rules Engine Now triggers the cron job inline — useful for dry-run or for admins without cron access.

Mass actions:

  • Toggle manual override — flip the override flag on selected rows
  • Delete — remove tracking rows. Does not revert applied actions.

Restock reversion (noindex action only)

When the cron sees a tracked product's stock return (stock_status = 1), it:

  1. Loads the product
  2. If meta_robots == 'noindex,follow', clears it (sets to NULL → falls back to store default)
  3. Deletes the tracking row

The check is exact-match on noindex,follow to avoid stomping on hand-written meta_robots values that happen to contain "noindex".

redirect and disable actions are NOT auto-reverted — those represent a deliberate decision that the SKU is gone for good. If a "discontinued" product genuinely returns:

  • For redirect: manually delete the redirect from url_rewrite
  • For disable: re-enable the product in the catalog

CLI

There's no dedicated CLI command for the OOS engine — use the Run Rules Engine Now button in the admin grid for one-shot triggers. The cron is the primary path.

Integration with Index Budget Audit

The out_of_stock_indexable auditor flags OOS-but-still-indexable products. That auditor's per-row Apply Fix sets meta_robots = noindex,follow immediately — same outcome as the OOS Rules Engine, but synchronous and per-row.

Use the auditor for one-off cleanup of legacy OOS products. Use the Rules Engine for ongoing automation.

Limitations

  • Stock check uses CatalogInventory's StockRegistry — third-party MSI/inventory modules with custom stock semantics may not integrate cleanly. Smoke-test with a few SKUs before relying on the engine.
  • No stock-level thresholdIsInStock = false is the trigger. Products with qty = 1 are still considered in stock.
  • Per-store action only — the engine doesn't aggregate "OOS in all stores" → "disable everywhere". Each store decides independently.