At a glance, some people might think that out of stock products are a good indicator of how well an eCommerce store is doing – it can be interpreted as a business having great demand for their items and achieving great sales.
However, managing out of stock products in Magento needs much more careful consideration, particularly to maintain the SEO value of those product pages and the revenue that went along with it.
In this blog post, we explore how Magento handles your eCommerce products when they sell out, and the options you have to ensure that your Magento store remains optimised for search engines.
How does Magento handle out of stock products?
In order to access your inventory, head to Catalog > Products in your Magento dashboard, and find your product.
If your product is in stock, your screen settings should look like this:
If your product is out of stock, your settings should look like this:
While Magento realises that one of your products is out of stock, then the platform automatically takes out of stock products off of your storefront – unless appropriate action is taken, then this will generate a 404 error message which is harmful to your Magento store’s SEO among other things.
How to display out of stock products
There are a number of options you could consider and as you’d expect, there is no right answer as to which Magento best practice should be employed to manage those out of stock product situations – it really depends on the circumstances.
Firstly, the decision is different depending on whether the product is temporarily out of stock, or permanently.
If the status is temporary, we’d recommend leaving the page live, but noting on the product page and in your schema markup that the product is out of stock. Whatever other solutions you might consider, do not remove the product.
You might also want to consider how that product is managed in Google Shopping campaigns – hopefully, you’re automating the output of a Shopping feed, which includes stock availability, in which case, this should be managed automatically.
If the product is permanently out of stock, there are still a few options to consider:
- Does this product generate sales? Head to Google Analytics and query the landing pages and product data to see how much traffic and how many sales this page gets.
- Does the product page have internal links and more importantly, external links to it?
- Is there a replacement product which is a close match?
Option #1: Leave the page live
Sometimes, a store owner will still want to display their ‘out of stock’ products for backorders. In that case, it is entirely possible to display your out of stock products.
To do this, head to Stores > Settings > Configuration > Catalog > Inventory > Stock Options. Your screen should look like this:
You need to make sure that the ‘Display Out of Stock Products’ option is enabled. Once this configuration is saved, users should still be able to see the pages for your out of stock products, but not have the option to add it to their carts.
If you would like to enable backorders for out of stock products, head to Stores > Configuration > Product Stock Options > Backorders
You should be able to find this option below:
The default options will not allow backorders, so you would have to change it to either of the following options
- Allow Qty Below 0 and Notify Customer
- Allow Qty Below 0
Essentially, the ‘Notify Customer’ function exists to allow your store to notify a customer if the item they want is a backorder.
The benefits to this are that the page stays live and, as it’s part of your internal content and linking, it is still valuable for SEO purposes. Any external links will still point to a live page.
However, the user experience – and therefore your conversion rate – could be affected. You’ll need to think carefully about the content on this page, repurposing it to recommend and link to the replacement product. That’s fine if you have a small inventory, but for a large inventory eCommerce store, that’s probably not practical at.
Recent SEO Posts
Digital marketers have often argued that WordPress is the best content management system you can really ask for, especially when
In today’s digital landscape, having a well-optimised website is crucial for independent schools to boost their online visibility and attract
As digital platforms and social networks swell with an influx of users, it’s high time for non-profit organisations to architect
Content marketing for charities and fundraising can be a powerful tool for engaging donors, volunteers, and supporters, building trust and
For a large inventory, you could end up with hundreds or thousands of out of stock product pages, which will lead to content bloat and ultimately could cause issues with duplicate content, cannibalisation and crawl budget.
Option #2: 301 redirect the out of stock product pages
A [301 Redirect] tells the search engine that this page has permanently moved, and redirects the user to that page. The 301 redirect passes page equity and the value of any external links, so it’s a sound strategy for retaining SEO rankings and value. But there’s a second question – where do you redirect to?
Redirecting to the homepage of your Magento store is possibly your first choice, but probably not the right one. You should really consider redirecting to the most relevant equivalent page, as this has more benefit for the user and should mean that the conversion rate isn’t quite so affected as it would be with a redirect to the home page.
In extreme circumstances, you could set up a custom page that covers a whole range which is no longer in stock and gives the user options to click through to the new range and equivalent products. While this means a lot more work and attention, it could give you an awesome page to rank in its own right, capturing those queries for end of life products.
If you do choose the product redirect option, also consider that long term, you could be redirecting to a redirect to a redirect as more products go out of stock, therefore creating a redirect chain. You’ll need to tidy those redirect chains up as you go, updating the first in the chain to the final destination.
How to clear out of stock items
While Magento will automatically hide an out of stock product from your customers, the product will still appear in your store’s backend. A stock Magento 2 installation doesn’t let you select ‘out of stock’ products only. A certified Magento developer would tell you that clearing out of stock products could be done with the following script:
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$app_state = $objectManager->get(‘\Magento\Framework\App\State’);
$productCollection = $objectManager->create(‘Magento\Catalog\Model\ResourceModel\Product\CollectionFactory’);
$collection = $productCollection->create();
$collection = $collection->addAttributeToSelect(array(‘name’, ‘sku’))
)->joinTable(‘cataloginventory_stock_item’, ‘product_id=entity_id’, array(‘stock_status’ => ‘is_in_stock’))
->addFieldToFilter(‘stock_status’, [‘eq’ => 0])
foreach($collection as $product)
Save that file as out_of_stock.php in your Magento 2 root folder and run it via SSH :
You can make it a cron job so that out of stock products get cleared daily or weekly.
How to Manage Product Bundles That Include Out of Stock Products?
Items sold in a bundle usually consist of items that are, or should, be purchased together. When you consider the price of the bundle and the individual price of the items, customers would find that buying the items in the bundle is cheaper than buying the items individually. A normal bundle will look like this:
Notice how Magento allows customers the option to choose what items they want. It’s also worth noting that Magento varies the price of bundles based on what items the person chooses.
If one of these products are out of stock, Magento will automatically hide the products from the storefront and lower the price of the bundle.
Whichever option and policy you choose for out of stock products in your Magento eCommerce Store, simply deleting products and leaving a heap of 404 errors is definitely not the right option – that will just throw your traffic and profits away.
Konstantin Gerasimov is a Magento Certified Developer with Goivvy.com. He specialises in Magento backend development, performance optimisation and extensions development.