/
/
Refund a WooCommerce order by the right route and amount
For support and store teams who want WooCommerce refunds issued safely, with no over-refunds, by asking their AI assistant.
On this page
Connector
Connect WooCommerce, pick your AI tool and paste the prompt.
The problem
Refunds sent the wrong way or for the wrong amount
Refunding a WooCommerce order means working out what has been refunded already, what is still refundable and whether money goes back through the gateway or by hand. Get the route wrong and the customer gets nothing back.
Without PopdockAI
- Add up earlier refunds on the order
- Work out what is still refundable
- Guess whether the gateway can refund it
- Leave the customer without their money
With PopdockAI
- Earlier refunds and lines are read to find what is refundable
- Unpaid and fully refunded orders are refused
- Manual payment methods are called out
- It refunds once after you confirm, and reads back the status
The prompt
Use this prompt
Copy it into any AI tool connected to PopdockAI. Swap the values in braces for your own.
**Objective:** Refund `{amount}` (default: everything still refundable) on order `{order-number}`, for the reason `{reason}`, through the right route for its payment method.
**Step 1: Find the order and what has already been refunded**
* `woocommerce-get-order` with `order-number` = `{order-number}`. Keep `order-id`, `status`, `total`, `currency`, `paid-date` and `payment-method-name`. If nothing matches, or more than one does, say so and stop.
* `woocommerce-get-refund` with `order-id`. Already refunded = the sum of the absolute `amount` values.
* `woocommerce-get-order-line` with `order-id`, to show what was bought.
Remaining refundable = `total` minus already refunded.
**Step 2: Check the refund**
* Status `pending`, `failed` or `cancelled` with no `paid-date`: nothing was paid. Refuse and stop.
* Remaining refundable is 0: say it is fully refunded and stop.
* `{amount}` empty: refund the full remaining amount. `{amount}` above the remaining amount, 0 or negative: stop and give the remaining amount.
* Route: pass `refund-via-gateway` false when `payment-method-name` is a manual method (Direct bank transfer, Check payments, Cash on delivery) or empty; the money must then be returned outside WooCommerce, and you must say so. Otherwise pass true.
**Step 3: Confirm**
Show: order number, customer, order total, already refunded, amount to refund now, currency, route (gateway or manual), reason. Point out that this tool refunds an amount, not line items, so stock is not restored; if the goods come back, the user can restock with the update-product-by-sku prompt. Wait for an explicit yes.
**Step 4: Refund**
Call `woocommerce-add-refund` once with `order-id`, `amount`, `reason` = `{reason}` and `refund-via-gateway`.
**Step 5: Verify and report**
Call `woocommerce-get-refund` with `order-id` and `woocommerce-get-order` with `order-id`. Report the refund id, amount, whether `refunded-payment` shows the gateway returned it, the new order status (a full refund moves the order to `refunded` on its own), and the amount still refundable.
**Rules & Guidelines:**
* The only write tool this prompt may call is `woocommerce-add-refund`, once.
* Do not call any other write tool (`woocommerce-add-order`, `woocommerce-update-order`, `woocommerce-add-order-note`, `woocommerce-send-order-details`, `woocommerce-add-customer`, `woocommerce-update-customer`, `woocommerce-add-product`, `woocommerce-update-product`, `woocommerce-update-product-variation`, `woocommerce-add-coupon`, `woocommerce-update-coupon`). In particular never set the status to `refunded` with `woocommerce-update-order`.
* If a gateway refund fails, report the gateway's error and stop. Never retry it as a manual refund without the user asking, because the customer would get nothing back.
**Validation:**
* If `{reason}` is empty, ask for one before refunding; it is shown on the order.
* If the user's confirmation is anything other than a clear yes, stop without writing.Who it's for
One answer, three teams that use it
Customer service agents
Refund a customer in one message
Give the order and reason and get the refundable amount and route before confirming.
Refund order 2381 in full, the parcel never arrived.
Finance teams
Avoid over-refunds
Amounts above what is left are rejected, so nothing is refunded twice.
Refund 15.00 on WooCommerce order 1760 for a late delivery, if there is enough left.
Store managers
Handle manual payments correctly
You are told when money must go back outside WooCommerce, so nobody assumes it was sent.
Refund WooCommerce order 1902 paid by bank transfer. How does the money get back?
How it works
What PopdockAI does when you ask
You give the order number, a reason and an amount, and your AI assistant checks what can be refunded and how. The refund is made once, only after you confirm.
01
Ask
You give the order number, a reason and an optional amount.
02
Check
It reads earlier refunds and lines to work out what is still refundable.
03
Confirm
You approve the amount, route and reason.
04
Refund
It refunds once and reads back the new status.
What PopdockAI provides
The tools behind the answer
Ready made tools for WooCommerce and one secure connection to your AI tool. No code, no exports.
woocommerce-get-order
woocommerce-get-refund
woocommerce-get-order-line
woocommerce-add-refund
This report is built from Get data tools only. PopdockAI applies the row, field and parameter rules your admin sets, and every query is written to the audit trail.
The outcome
Refunds by the right route, for the right amount
Related use cases
More ways to put this data to work
One prompt template with infinite possibilities.
Your AI assistant adapts its approach, tone, and capabilities to match each unique context while you maintain a single, manageable workflow.
Join forward-thinking companies that are transforming their operations with intelligent, secure AI automation.

.webp)
