DEV Community

Cover image for The Product Recommender That Only Suggested Out-of-Stock Items (Inventory Integration Fail)
FARHAN HABIB FARAZ
FARHAN HABIB FARAZ

Posted on

The Product Recommender That Only Suggested Out-of-Stock Items (Inventory Integration Fail)

I built a product recommendation bot for an e-commerce site. It analyzed what customers were looking at and suggested related items. Smart recommendations. Higher conversions. Standard upsell automation.
First week, conversion rate dropped by forty one percent. Customers were leaving angry reviews. "Why does your bot keep recommending things you don't have?"
The bot was only suggesting out-of-stock products.

The Setup
E-commerce company selling electronics. Customers browsed products, and the bot suggested complementary items. Looking at a laptop, the bot suggests a laptop bag, mouse, and external drive. Looking at a camera, the bot suggests memory cards, tripods, lenses.
I connected the bot to their product catalog API. It pulled product data, analyzed relevance, and made recommendations based on what fit well together.
Tested with fifty browsing sessions. Recommendations looked perfect. Related products. Good pairings. Deployed.

The Complaints Start
Within three days, customer complaints arrived in waves. People clicking recommended products and landing on "Out of Stock" pages. Others adding recommended items to cart only to see "Item Unavailable" at checkout.
One customer left a review: "This site keeps suggesting products they don't even sell anymore. Waste of my time."
I checked the recommendation logs. Out of four hundred twelve recommendations made that week, three hundred seventy nine were out-of-stock items. Ninety two percent of suggestions were unavailable.

Why This Happened
My product recommendation logic searched the entire catalog for relevant matches. Laptop cases that pair well with laptops. Camera lenses that fit specific camera models. The algorithm found the best technical matches.
But it never checked stock levels. The API call pulled product details, descriptions, specifications, and compatibility data. I never added inventory status to the query.
The result was recommendations based purely on product fit, ignoring whether the item could actually be purchased. The bot became an expert at suggesting things customers could not buy.

The Irony
The out-of-stock products were often the most popular items. High demand meant frequent stockouts. High popularity also meant strong historical sales data, which made the recommendation algorithm rank them highly.
The bot was recommending the best products, the ones customers actually wanted, at exactly the moment those products were unavailable. It was technically correct and practically useless.

The Failed Fix
I added inventory checks after generating recommendations. If an item was out of stock, the bot removed it from the list and suggested the next best alternative.
That created a new problem. The backup recommendations were worse matches. A customer looking at a high-end camera got recommendations for cheap accessories that did not fit the quality level, because all the premium accessories were out of stock.
The bot went from suggesting unavailable great products to suggesting available mediocre products. Conversion still dropped.

The Real Solution Was Smart Filtering
The fix required filtering at the source, not after the fact. The recommendation algorithm now checks inventory status during the matching process, not after.
When building recommendations, the system first filters the catalog to only in-stock items, then applies the relevance algorithm within that subset. If the best match is out of stock, it never enters consideration at all.
I also added a secondary filter based on stock velocity. If an item has fewer than five units remaining and historical data shows it sells twenty units per day, the system treats it as effectively out of stock, because it will likely be gone before the customer completes checkout.
For high-value recommendations where no good in-stock alternative exists, the system shows a placeholder: "Customers also liked [Product Name] – currently restocking, available [estimated date]." That way, the customer knows about the better option without being sent to a dead end.

What Changed
Customers browsing laptops now saw in-stock laptop bags, in-stock mice, and in-stock drives. If the premium option was unavailable, they saw the next-best option that was actually purchasable.
The recommendations stopped being technically perfect and started being practically useful. Conversion rates recovered and then exceeded the pre-bot baseline.

The Results
Before the fix, ninety two percent of recommendations were out of stock, conversion dropped forty one percent, cart abandonment spiked, and customer complaints flooded in.
After the fix, ninety seven percent of recommendations were in stock, conversion exceeded baseline by eighteen percent, cart abandonment returned to normal, and complaints about recommendations stopped entirely.
The business impact was immediate. Revenue per session increased because customers were clicking recommendations and actually buying. Customer satisfaction improved because the site stopped wasting their time.

What I Learned
Relevance without availability is useless. The best recommendation is worthless if the customer cannot buy it. Inventory status is not optional metadata. It is a primary filter.
Systems that recommend products must treat stock levels as a core constraint, not an afterthought. Filtering after recommendation generation creates poor fallback suggestions. Filtering during recommendation generation ensures quality matches within what is actually available.

The Bottom Line
A recommendation bot that ignored inventory status suggested unavailable products ninety two percent of the time. The fix was checking stock levels during the matching process, not after, and treating low inventory as effectively out of stock to avoid checkout failures.

Written by Farhan Habib Faraz
Senior Prompt Engineer building conversational AI and voice agents

Tags: ecommerce, recommendations, inventory, automation, productsuggestions, conversionoptimization

Top comments (0)