During the English Google SEO Office-Hours From November 26, 2021, at roughly the 44-minute, 28-second mark, Google Search Advocate John Muller addressed a few related questions about out-of-stock products and SEO.
The questions, paraphrased, were:
“How does Google treat an out-of-stock page? Will Google take actions on that page—for example, crawl less and lower the rankings of that page?”
Those questions were followed by a bit more detail about this specific situation: “Structured data has been deleted, so it won't display ‘out of stock’ in the search results.”
John Mueller’s response (which I’ve edited for clarity, was):
“We do try to understand when a page is no longer relevant, based on the content of that page. So, in particular, the common example is a soft 404 page, where you serve a page that looks like it could be a normal page, but it's essentially an error page that says, ‘This page no longer exists.’
“And we do try to pick up things like that for e-commerce as well. So that's something where you might see that out-of-stock products are seen as soft 404 pages. When they're seen as soft 404 pages, we drop them completely from search. If we keep the page indexed despite being out of stock, we will not change the ranking.
“It'll be ranked essentially normally still.
“It's also still ranked normally if you change the structured data and say that something is out of stock. So from that point of view, it's not that the page would drop in ranking. It's more that either it's seen as a soft 404 page or it's not. If it's not seen as a soft 404 page, it's still a normal page.”
So, for out-of-stock pages and how Google ranks them, I see 2 possibilities:
So, when it comes to Google and out-of-stock products, those are the 2 basic options, the second one being the better option for SEO and rankings.