Check for IKEA item availability

If you're waiting for an IKEA item to restock, here's a practical solution to stay updated automatically. This guide explains how to use a shell script to check IKEA's stock availability and get notified when your desired item is back in stock.

IKEA's inventory updates frequently, and certain popular items can sell out quickly. This script eliminates the hassle of manually checking the stock repeatedly. By automating the process, you can focus on other tasks and still be among the first to know when the item is available.

Overview


This shell script works on any *NIX-based system with curl installed. It uses IKEA's API to check item availability and notifies you via Slack when the item is available. The flexibility of this script makes it a perfect tool for shoppers who want to secure in-demand products without constant manual effort.

IKEA API Response


To check an item's availability, use the following API endpoint, replacing th with your country code:

For example, in Thailand, IKEA has two stores near OOZOU's office. This script is configured to check availability at either of these stores.

The response from the API includes details about the stock status in specific stores. By parsing this response, the script identifies whether the item is available, making it a highly efficient solution.

The Script


#!/usr/bin/env bash

url="https://www.ikea.com/th/en/iows/catalog/availability/$1"

# This is the string that we want to see changed
string="0"

while true; do
  # Get the API response and return as string
  text=$(curl -s "$url")

  # Get a count of how many times the substring matches
  count=`grep -o "$string" <<< "$text" | wc -l`

  # If less than 2, then it's available!
  if (( $count < 2 )); then
    echo "AVAILABLE, yay.";
    # Notify us via Slack
    curl -X POST --data-urlencode "payload={\"channel\": \"…\", \"username\": \"ikea\", \"text\": \"Item $1 is now available at IKEA.\", \"icon_emoji\": \":shooping_bags:\"}" https://hooks.slack.com/services/…
    break
  else
    # If not available, sleep for 30s
    echo "$1 not in stock"
    sleep 30
  fi
done



How to Use


1. Save the script as check.sh and make it executable:

chmod +x check.sh

2. Run the script by passing the IKEA item ID as an argument:

./check.sh S99067497

3. Replace the Slack webhook URL and channel details with your own.

This straightforward process ensures you can monitor item availability with minimal effort. It's particularly useful if you frequently shop at IKEA and want to avoid missing out on high-demand products.

Key Features


  • API Integration: Uses IKEA's API to fetch real-time stock data.
  • Slack Notifications: Sends instant alerts to your chosen Slack channel.
  • Customisable: Adjust the script for different country codes, item IDs, or notification methods.
  • Time-Saving: Automates stock monitoring, freeing you from repetitive checks.
  • User-Friendly: The script is simple to configure and run, even for beginners.

Tips


  • Ensure you have curl installed on your system.
  • Modify the sleep interval (default: 30 seconds) based on your preference.
  • For Slack notifications, create and use your own Slack webhook URL.
  • Test the script with a sample item ID to ensure it's working correctly before relying on it for high-priority items.

Monitoring IKEA stock manually can be time-consuming and tedious. With this script, you can stay informed without constant effort, ensuring you don't miss out on the items you need. Whether it's furniture, home accessories, or any other IKEA product, this tool is a must-have for savvy shoppers. Happy shopping!
5
Const

Get our stories delivered

From us to your inbox weekly.