Hardware stock moves in odd ways. A specific fitting can disappear for weeks because one supplier is late, while the rest of the category is fine. On our store, RAMO, that used to mean a small panic every time: do we hide the page, redirect it, or leave it up?
We went back and forth on it, and ended up writing the answer down as a few rules in code instead of deciding per product. Sharing them here because the "just 404 it" instinct is pretty common and it usually costs more than it saves.
Rule 1: temporarily out of stock means the page stays exactly where it is
If we expect the item back, the URL keeps returning 200 with the full page. The only things that change:
the buy button becomes a "notify me" form
the structured data says so honestly
the page shows a short "similar items in stock" block
const availability = product . stock > 0 ? 'https://schema.org/InStock' : product . restockExpected ?…