The history of a page, or its URL, is an important criterion for SEO. Every URL ranks for keywords thanks to that history: quality of content, internal linking, backlinks...
If a webpage was deleted, it is paramount to ensure that a history transfer can happen to preserve the rankings previously occupied. If that transfer is not implemented, you might have Google look for the old version of your page, at the expense of the new strategic version.
At the end of a product/page/article's lifecycle, it is important to re-allocate the history cumulated by that page and redistribute it to a similar page. This process has to be automated.
Case 1 : Simple change of URL
If a page has a new URL, a simple 301 redirect to the new page is enough
Frequent case: the title, the name of the category or even the H1 has changed, the URL will therefore be modified automatically, a 301 redirect will be done => in order to avoid this case where redirects might not be well implemented, we advise you against linking the title or H1 tag of the page with its URL.
Case 2 : Page's end of life (end of a collection or range)
In case a page has its life cycle that comes to an end, redirect its URL automatically via a 301 redirect to a similar page or the parent category. In the case where the page is deleted, make sure that we do not find any relevant and unique content and in that case, use it somewhere else on the website.
Case 3 : Seasonal discounts ( 30% off a selection of products, BLACK Friday, Christmas gifts, Valentine's day, Mother's Day etc...)
Case 4 : Product that ran out of stock
If a product is currently out of stock but will be available again in the next few months, keep the page and its URL and inform the user that the product will be available again soon.
In order to avoid a high bounce rate and a negative experience on these types of URLs, suggest the user to get a notification email once the product is available again or suggest similar products.
If the product won't be available again = > cf case 2 = the page will have to be redirected
Case 5 : Absence of similar pages
If a URL does not have any similar page towards which it could be redirected and has a very low interest for SEO (low rankings, no traffic, no backlinks) then apply a 410 http status code to that page in order to tell Google not to explore the page anymore.
If the URL does not have any similar page towards which it could be redirected but has an interest for SEO (backlinks, strategic rankings), apply a 301 redirect to a superior category or the homepage
WARNING: In all cases
Clean your internal linking in order to have all the old URLS disappear from your website: remove the old/wrong URLs from internal linking, from the sitemap.xml or from the suggested products. That will help Google take the changes into account quicker. It is important to automate this task in the development of the new website.