Dev.to AI 🤖 Ai 👁 0 📖 4 min read

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 t

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);
}

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?

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.