--- title: Add back-in-stock email notifications to WooCommerce description: WooCommerce shows stock status but has no customer-facing waitlist. This small plugin adds a sign-up form and emails subscribers when stock returns. source: https://steem.dev/blog/woocommerce-back-in-stock-notification-plugin published: 2026-09-19 updated: 2026-10-31 alternative_to: Back In Stock Notifier for WooCommerce site: Steem — AI WordPress plugin generator --- # Add back-in-stock email notifications to WooCommerce WooCommerce emails the store admin when stock runs low and offers the customer nothing. A visitor on an out-of-stock product page sees the status and that is all: no sign-up field, no waiting list, no email when you restock. They check back, or they leave. That visitor is worth more than most. An abandoned-cart email chases someone who hesitated at the basket; a back-in-stock email reaches someone who found exactly what they wanted and could not have it. The intent is already there, which is why these emails tend to convert better than most automations. The plugin adds a shortcode for the sign-up form, stores each address against the product, and emails everyone on the list when you set the product back in stock. Nothing leaves your server and there is no subscription fee. ## What one build covers - Sign-up form shortcode for product pages: customers enter their email and are queued for that product - Automatic email to all subscribers when the product stock status is set to in stock - Subscriber list cleared after sending so each address receives one notification per restock cycle - Admin table at WooCommerce > Back In Stock showing subscriber count and most recent signup per product ## What it does not cover - Variation-level waiting lists: tracks the parent product, not individual variations of a variable product - Background sending: notifications fire synchronously in the admin save request, which is slow for large lists - Double opt-in confirmation before adding a subscriber to the list - Integration with external email platforms such as Klaviyo, Brevo or Mailchimp - Subscriber export or per-subscriber management in the admin table ## The prompt ```text Build a WordPress plugin called WC Back In Stock. Plugin Name: WC Back In Stock. Version: 1.0.0. Description: Let customers sign up for back-in-stock emails on WooCommerce products, visible under WooCommerce > Back In Stock. Wrap all code in a class WC_Back_In_Stock with a public init() method. Instantiate the class and call init() on plugins_loaded. Database setup: Register register_activation_hook(__FILE__, ['WC_Back_In_Stock', 'create_table']). In the static method create_table: global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table = $wpdb->prefix . 'wc_back_in_stock'; $sql = "CREATE TABLE $table ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, product_id BIGINT UNSIGNED NOT NULL, email VARCHAR(200) NOT NULL, subscribed_at DATETIME NOT NULL, PRIMARY KEY (id), KEY product_id (product_id) ) $charset_collate;"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta($sql); Sign-up form: In init(), add_shortcode('wc_back_in_stock_form', [$this, 'render_form']). In render_form($atts, $content, $tag): $output = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['wc_bis_email']) && wp_verify_nonce($_POST['_wpnonce'] ?? '', 'wc_bis_signup')) { $product_id = get_the_ID(); $email = sanitize_email($_POST['wc_bis_email']); if (!is_email($email)) { $output .= '
Please enter a valid email address.
'; } else { global $wpdb; $exists = $wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->prefix}wc_back_in_stock WHERE product_id = %d AND email = %s", $product_id, $email)); if ($exists) { $output .= 'You are already signed up for this product.
'; } else { $wpdb->insert($wpdb->prefix . 'wc_back_in_stock', ['product_id' => $product_id, 'email' => $email, 'subscribed_at' => current_time('mysql')], ['%d', '%s', '%s']); $output .= 'We will email you when this product is back in stock.
'; } } } $output .= ''; return $output; Stock notification: In init(), add_action('woocommerce_product_set_stock_status', [$this, 'maybe_notify'], 10, 3). In maybe_notify($product_id, $status, $product): if ($status !== 'instock') { return; } global $wpdb; $rows = $wpdb->get_results($wpdb->prepare("SELECT email FROM {$wpdb->prefix}wc_back_in_stock WHERE product_id = %d", $product_id)); if (empty($rows)) { return; } $name = $product->get_name(); $url = get_permalink($product_id); $subject = $name . ' is back in stock'; $body = $name . " is back in stock.\n\nShop now: " . $url; foreach ($rows as $row) { wp_mail($row->email, $subject, $body); } $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}wc_back_in_stock WHERE product_id = %d", $product_id)); Admin page: In init(), add_action('admin_menu', [$this, 'add_admin_page']). In add_admin_page(): add_submenu_page('woocommerce', 'Back In Stock', 'Back In Stock', 'manage_woocommerce', 'wc-back-in-stock', [$this, 'render_admin_page']). In render_admin_page(): global $wpdb; $rows = $wpdb->get_results("SELECT product_id, COUNT(*) as cnt, MAX(subscribed_at) as latest FROM {$wpdb->prefix}wc_back_in_stock GROUP BY product_id ORDER BY cnt DESC LIMIT 100"); echo 'No subscribers waiting.
'; } else { echo '| Product | Subscribers | Latest signup |
|---|---|---|
| ' . esc_html($title) . ' | ' . intval($row->cnt) . ' | ' . esc_html($row->latest) . ' |