WooCommerce low or out of stock notifications on your phone.

Get a push notification when a WooCommerce product runs low or sells out, with how many are left.

product.updatedE-commerceOrders
How it works

Three steps to your first push

STEP 01

Install the recipe

One click in Studio gives you a personal webhook URL.

STEP 02

Paste your URL into WooCommerce

Add it as a webhook for Product updated.

STEP 03

Get a push on your phone

With the text, sound and buttons from the recipe.

Setup

How to set up the WooCommerce product updated webhook

  1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL.
  2. In your WordPress admin, go to WooCommerce > Settings > Advanced > Webhooks and click Add webhook.
  3. Set Status to Active, Topic to Product updated, and API version to WP REST API Integration v3.
  4. Paste your webhook URL as the Delivery URL and save. WooCommerce sends a ping right away to confirm it works.https://••••••••/•••••••• your personal URL, shown after install
The code

What runs when the webhook arrives

Studio calls handleRequest(request) with the incoming webhook and sends the message it returns. It's yours after install; change anything.

transform.js
1// WooCommerce → product.updated (low or out of stock)
2// Docs: https://woocommerce.com/document/webhooks/
3//
4// Add a webhook under WooCommerce > Settings > Advanced > Webhooks with the topic
5// "Product updated" and API version v3, pointing at your integration's endpoint URL.
6
7// WooCommerce's default "low stock threshold" (Settings > Products > Inventory).
8// Change this if you've changed it there.
9const LOW_STOCK_DEFAULT = 2
10
11// WooCommerce prices are decimal strings ("49.00"). Returns null when there's no amount.
12function money(amount, currency) {
13 const value = Number(amount)
14
15 if (amount == null || amount === "" || !Number.isFinite(value) || !currency) return null
16
17 try {
18 return new Intl.NumberFormat("en-GB", { style: "currency", currency }).format(value)
19 } catch {
20 return `${amount} ${currency}`
21 }
22}
23
24// Header names can arrive in any case.
25function header(request, name) {
26 const headers = request.headers || {}
27 const key = Object.keys(headers).find((k) => k.toLowerCase() === name)
28 const value = key ? headers[key] : null
29 return Array.isArray(value) ? value[0] : value
30}
31
32// X-WC-Webhook-Source is your store's URL, e.g. "https://shop.example.com/".
33function adminUrl(request, path) {
34 const source = header(request, "x-wc-webhook-source")
35 return typeof source === "string" && /^https?:\/\//.test(source)
36 ? source.replace(/\/?$/, "/") + "wp-admin/" + path
37 : null
38}
39
40function handleRequest(request) {
41 const body = request.body && typeof request.body === "object" ? request.body : {}
42
43 // Saving a webhook makes WooCommerce send a ping (just a webhook_id); confirm it quietly.
44 if (body.webhook_id && !body.id) {
45 return {
46 title: "🔔 WooCommerce connected",
47 message: `Webhook #${body.webhook_id} is working`,
48 topic: "WooCommerce",
49 priority: -1,
50 }
51 }
52
53 // Guard: only handle this topic, so other WooCommerce webhooks on this integration stay quiet.
54 const topic = header(request, "x-wc-webhook-topic")
55
56 if (topic && topic !== "product.updated") {
57 console.log(`Ignoring WooCommerce topic "${topic}"`)
58 return null
59 }
60
61 const product = body
62
63 if (!product.id || !product.name) {
64 console.log("Not a WooCommerce product payload — skipping")
65 return null
66 }
67
68 const managed = product.manage_stock === true && typeof product.stock_quantity === "number"
69 const out = product.stock_status === "outofstock" || (managed && product.stock_quantity <= 0)
70 // The product's own threshold if it has one, otherwise the store default of 2.
71 const own = product.low_stock_amount
72 const threshold = own !== null && own !== "" && Number.isFinite(Number(own)) ? Number(own) : LOW_STOCK_DEFAULT
73 const low = managed && product.stock_quantity > 0 && product.stock_quantity <= threshold
74
75 // product.updated fires for every change; only stock problems are worth a push.
76 if (!out && !low) {
77 console.log(`"${product.name}" has enough stock — skipping`)
78 return null
79 }
80
81 const link = adminUrl(request, `post.php?post=${product.id}&action=edit`)
82 const sku = product.sku ? ` (SKU ${product.sku})` : ""
83
84 return {
85 title: out ? "📦 Out of stock" : "📉 Low stock",
86 message: out ? `${product.name}${sku} sold out` : `${product.name}${sku}: ${product.stock_quantity} left`,
87 topic: "WooCommerce",
88 priority: out ? 1 : 0, // High when you're losing sales, Normal as a heads-up
89 buttons: link ? [{ cta: "View product", url: link }] : [],
90 }
91}
Payload

The WooCommerce product.updated webhook

This is what WooCommerce sends to your URL for product updated. It is a sample, trimmed to the fields recipes use.

product.updated · sample.json
1{
2 "id": 101,
3 "sku": "PIN-01",
4 "name": "Enamel Pin",
5 "type": "simple",
6 "price": "12.00",
7 "status": "publish",
8 "manage_stock": true,
9 "stock_status": "instock",
10 "stock_quantity": 2,
11 "low_stock_amount": null
12}
FAQ

WooCommerce low or out of stock notifications: questions

Does this work on iPhone and Android?

Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification.

Do I need to write code?

No. Install the recipe in Studio, paste your webhook URL into WooCommerce and you are done. The code is there if you want to change the text, the sound or the buttons.

Can I change what the notification says?

Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save.

What does it cost?

JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.

Ready when you are

WooCommerce on your phone in two minutes.

Install the recipe, paste one URL, done. Free for 30 days, no credit card required.