DEV Community

Cover image for The Black Friday chatbot test I’d run on Shopify: Sell out the backup, too
Rajni Walia
Rajni Walia

Posted on

The Black Friday chatbot test I’d run on Shopify: Sell out the backup, too

A shopper clicks your Black Friday ad for wireless headphones. The featured pair is sold out, so they message your store on WhatsApp.

“Anything wireless under $100 that can arrive by Friday?”

The chatbot recommends the black pair for $94. Before the shopper opens the link, someone buys the last one.

“Can I still buy the pair you just sent me?”

That’s the regression test I’d run before the ads go live. Can the bot identify the exact variant it recommended, check stock again, and carry the shopper’s budget and deadline into its next reply?

Keep the shopper’s preferences and refresh the product data

The shopper’s budget is still $100. The stock result from the previous message may already be stale.

Keep in conversation state Check before replying
Product requirements Availability of the exact variant
Budget and currency Current variant price in the shopper’s market
Delivery deadline and ZIP code, if provided Delivery estimate for that destination, if available
Last recommended variant ID Whether the link selects the variant being recommended

Store the variant ID with the recommendation

The product page can still show the headphones as available when the black pair is sold out. Store the exact variant ID so a follow-up about “the pair you just sent me” points to the right item. Open the variant link in your storefront theme to confirm it selects the intended color or size. Shopify’s guide to variant links

Recheck Shopify before generating the reply

Shopify’s Storefront API exposes availableForSale and currentlyNotInStock on ProductVariant. A backordered item can be available for purchase while out of stock. Check whether the variant can be purchased, whether it’s in stock, and whether you have a delivery estimate. Shopify’s ProductVariant reference

Search the catalog for candidates, then verify them

Use a catalog index to find alternatives and a fresh Shopify read to verify any variant you plan to recommend. Webhooks can refresh the index in the background. Make the update handler idempotent so duplicate deliveries leave the index in the same state. Shopify’s guide to webhook deliveries

Here’s the decision flow in TypeScript-style pseudocode. The helper functions represent calls in your own integration.

async function handleAvailabilityFollowUp(state: ShopperState) {
  const previous = await readCurrentVariant(
    state.lastRecommendedVariantId,
    state.market,
  );

  if (previous.status === "lookup_failed") {
    return replyThatStockCouldNotBeConfirmed(state);
  }

  if (
    previous.status === "found" &&
    previous.variant.availableForSale &&
    !previous.variant.currentlyNotInStock
  ) {
    return describeCurrentOption(previous.variant, state);
  }

  const candidateIds = await findAlternativeVariantIds(
    state.productRequirements,
  );
  const candidates = await readCurrentVariants(candidateIds, state.market);

  if (candidates.status === "lookup_failed") {
    return replyThatStockCouldNotBeConfirmed(state);
  }

  return describeVerifiedAlternatives(candidates.variants, state);
}
Enter fullscreen mode Exit fullscreen mode

Both reply paths compare the current price with the shopper’s budget and use a delivery estimate when one is available. Stock can still change between the check and checkout.

Show the trade-off when no option fits

If you can confirm stock but have no delivery estimate, give the shopper a way to check.

“The blue pair is in stock at $94 before shipping. Enter your ZIP code at checkout to see whether it can arrive by Friday.”

If one option fits the budget and another fits the deadline, put both in the same reply.

“The $89 pair is estimated to arrive Monday. The $119 pair is estimated to arrive Friday. Which works better for you?”

Quote the replacement’s current price. The Black Friday discount in the original ad may apply only to the featured item.

Run the two-sellout test before Black Friday

Reproduce the stock change in a Shopify test store

  1. Mark the featured headphones as sold out.
  2. Ask your WhatsApp chatbot for an alternative under $100 that can arrive by Friday.
  3. Mark the exact variant it recommends as sold out. Leave another color of the same product in stock.
  4. Stay in the same chat and ask, “Can I still buy the pair you just sent me?”

Check the reply, the product link, and the fallback

Test case Expected behavior
The recommended color sells out before the catalog index refreshes The bot checks that exact variant again and stops recommending it as in stock.
Another variant fits the budget and deadline The bot carries over both requirements and sends a link to the exact variant. Open the link and try adding it to the cart.
No variant fits both requirements The bot explains the price or delivery trade-off and labels delivery dates as estimates.
The inventory lookup fails The bot says it couldn’t confirm stock and gives the shopper a way to check.

Run the follow-up immediately after changing stock and again after the index refreshes. Log the variant ID, stock result, check timestamp, and URL sent. Those fields help you tell whether the bot used stale data, lost the variant reference, or sent a link that opened the wrong option.

If you’re using YourGPT, follow the Shopify WhatsApp chatbot setup guide to connect the store and sync the catalog before running the test against your own storefront.
ate the chatbot can’t verify?

Top comments (6)

Collapse
 
hiredov profile image
Dov at HireDov •

Good test, and the 'sell out the backup too' part is the one most stores skip. One thing I'd add from the supply side: the chatbot can only be as honest as the restock data behind it. If the backup variant shows in stock but the supplier's real lead time is three weeks, the bot will promise Friday delivery on something that isn't even on a shelf yet. Storing a per-variant supplier lead time (and a safety-stock floor for Black Friday week) lets the bot say 'ships in 2-3 weeks' instead of guessing. Does your regression test also cover backordered variants, where availableForSale is true but there is no real delivery estimate, and what should the bot say there?

Collapse
 
rajni_walia_e6082454c67a9 profile image
Rajni Walia •

Good catch. I’d add a separate regression case for availableForSale: true with no confirmed ship date. The expected reply would be: “You can order this variant now, but it’s on backorder and we don’t have a confirmed ship date yet.” If there’s a reliable estimate for that variant, the bot can say “estimated to ship in 2–3 weeks” and keep that separate from the delivery date.

Collapse
 
mohit_kumar_dcabab5c7ebd7 profile image
Mohit Kumar •

insightful 💡

Collapse
 
rajni_walia_e6082454c67a9 profile image
Rajni Walia •

Thanks! Glad you found it insightful 💡

Collapse
 
ethan_clarke_0e14fa6f8e00 profile image
Ezisa Crook •

Excellent use case! Rechecking live inventory and preserving shopper context are essential for reliable AI-powered shopping experiences, especially during peak sales events.

Collapse
 
rajni_walia_e6082454c67a9 profile image
Rajni Walia •

Thanks! The case I wanted to catch is when both the original item and the backup sell out mid-chat. The bot should recheck stock and use the size and budget the shopper already shared to suggest another option. If nothing fits, it should say so.