Connectors

/

WooCommerce

/

Refund a WooCommerce order
Write

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.

Try PopdockAI free
Get a live demo
Refund a WooCommerce order
Refund 24.00 on WooCommerce order 1042, the mug arrived broken.
Order 1042 has 104.00 still refundable, so a 24.00 refund is fine. - Amount: 24.00 - Route: back to the card through the payment gateway - Reason: Mug arrived broken Shall I issue the refund?
WooCommerce
Sample figures. Your results come from your own account.
woocommerce-get-order
woocommerce-get-refund
woocommerce-get-order-line
woocommerce-add-refund

On this page

The problem

The problem

The prompt

Who it's for

How it works

Tools used

Connector

WooCommerce

WooCommerce
Run it on your own WooCommerce data.

Connect WooCommerce, pick your AI tool and paste the prompt.

Try PopdockAI free

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.

Prompt
**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.

Your AI tool

02

Check

It reads earlier refunds and lines to work out what is still refundable.

woocommerce-get-order
woocommerce-get-refund
woocommerce-get-order-line

03

Confirm

You approve the amount, route and reason.

No items found.

04

Refund

It refunds once and reads back the new status.

Your AI tool

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.

get-data

woocommerce-get-order

Returns WooCommerce orders with status, totals, discounts, shipping, payment method and paid date. Filter by status, customer email or id, order number, created date range, total range or billing last name.
get-data

woocommerce-get-refund

Returns WooCommerce refunds with amount, reason, who made them and whether the gateway returned the money. Filter by order, customer, amount range and date range.
get-data

woocommerce-get-order-line

Returns the product lines on WooCommerce orders: product, SKU, quantity, price, line total and tax. Filter by order, customer, SKU or product id, order status and date range.
run-action

woocommerce-add-refund

Refunds an amount on a WooCommerce order, through the payment gateway or as a manual refund, with a reason shown on the order.
Read only.Nothing in WooCommerce Changes

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.

How Popdock AI secures your data

The outcome

Refunds by the right route, for the right amount

Try PopdockAI free
Get a live demo

Related use cases

More ways to put this data to work

All Ramp use cases

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.

Try PopdockAI Free
See Documentation