WooCommerce order refunded, failed or cancelled notifications on your phone.

Get a push notification when a WooCommerce order is refunded, fails payment, or is cancelled.

order.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 Order 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 order 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 Order 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 → order.updated (order refunded, failed or cancelled)
2// Docs: https://woocommerce.com/document/webhooks/
3//
4// Add a webhook under WooCommerce > Settings > Advanced > Webhooks with the topic
5// "Order updated" and API version v3, pointing at your integration's endpoint URL.
6
7// The order statuses worth a push, and how loud to be.
8const STATUSES = {
9 refunded: { title: "↩️ Order refunded", priority: -1 }, // Low — usually you did it yourself
10 failed: { title: "🚫 Payment failed for order", priority: 1 }, // High — a customer couldn't pay
11 cancelled: { title: "❌ Order cancelled", priority: 0 },
12}
13
14// WooCommerce prices are decimal strings ("49.00"). Returns null when there's no amount.
15function money(amount, currency) {
16 const value = Number(amount)
17
18 if (amount == null || amount === "" || !Number.isFinite(value) || !currency) return null
19
20 try {
21 return new Intl.NumberFormat("en-GB", { style: "currency", currency }).format(value)
22 } catch {
23 return `${amount} ${currency}`
24 }
25}
26
27// Header names can arrive in any case.
28function header(request, name) {
29 const headers = request.headers || {}
30 const key = Object.keys(headers).find((k) => k.toLowerCase() === name)
31 const value = key ? headers[key] : null
32 return Array.isArray(value) ? value[0] : value
33}
34
35// X-WC-Webhook-Source is your store's URL, e.g. "https://shop.example.com/".
36function adminUrl(request, path) {
37 const source = header(request, "x-wc-webhook-source")
38 return typeof source === "string" && /^https?:\/\//.test(source)
39 ? source.replace(/\/?$/, "/") + "wp-admin/" + path
40 : null
41}
42
43function handleRequest(request) {
44 const body = request.body && typeof request.body === "object" ? request.body : {}
45
46 // Saving a webhook makes WooCommerce send a ping (just a webhook_id); confirm it quietly.
47 if (body.webhook_id && !body.id) {
48 return {
49 title: "🔔 WooCommerce connected",
50 message: `Webhook #${body.webhook_id} is working`,
51 topic: "WooCommerce",
52 priority: -1,
53 }
54 }
55
56 // Guard: only handle this topic, so other WooCommerce webhooks on this integration stay quiet.
57 const topic = header(request, "x-wc-webhook-topic")
58
59 if (topic && topic !== "order.updated") {
60 console.log(`Ignoring WooCommerce topic "${topic}"`)
61 return null
62 }
63
64 const order = body
65
66 if (!order.id || !order.status) {
67 console.log("Not a WooCommerce order payload — skipping")
68 return null
69 }
70
71 // order.updated fires for every change; only these statuses are worth a push.
72 if (!Object.prototype.hasOwnProperty.call(STATUSES, order.status)) {
73 console.log(`Skipping order in status "${order.status}"`)
74 return null
75 }
76
77 const billing = order.billing ?? {}
78 const customer = [billing.first_name, billing.last_name].filter(Boolean).join(" ") || billing.company || "A guest"
79 const total = money(order.total, order.currency)
80 const number = order.number ?? order.id
81 const link = adminUrl(request, `admin.php?page=wc-orders&action=edit&id=${order.id}`)
82 const status = STATUSES[order.status]
83
84 return {
85 title: `${status.title} #${number}`,
86 message: `${customer}` + (total ? ` · ${total}` : ""),
87 topic: "WooCommerce",
88 priority: status.priority,
89 buttons: link ? [{ cta: "View order", url: link }] : [],
90 }
91}
Payload

The WooCommerce order.updated webhook

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

order.updated · sample.json
1{
2 "id": 1234,
3 "total": "49.00",
4 "number": "1234",
5 "status": "refunded",
6 "billing": {
7 "email": "[email protected]",
8 "company": "",
9 "country": "NL",
10 "last_name": "Doe",
11 "first_name": "Jane"
12 },
13 "refunds": [
14 {
15 "id": 1240,
16 "total": "-49.00",
17 "reason": "Arrived damaged"
18 }
19 ],
20 "currency": "EUR",
21 "line_items": [
22 {
23 "id": 1,
24 "name": "Enamel Pin",
25 "total": "24.00",
26 "quantity": 2,
27 "product_id": 101
28 }
29 ]
30}
FAQ

WooCommerce order refunded, failed or cancelled 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.