30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

Refund an Order

store/refund-order records a refund against an order, in whole or in part, and optionally puts the items back into stock. It refuses without confirm: true.

It records the refund. It does not move any money.

Before you run it

This records a refund in WooCommerce. It does not send money back through the payment provider — that has to be done in the provider’s own dashboard. A refund recorded here and not issued there leaves the books saying the customer was paid when they were not. The response says so explicitly, so that nobody reads a success as “the customer has their money”.

At a glance

Abilitystore/refund-order
ToolsetWooCommerce — toolset/woocommerce
GroupWooCommerce › Orders & Refunds
RequiresWooCommerce, active on the site
Capabilitymanage_options
SafetyDestructive — records a refund that cannot be reversed, and refuses to run without confirm: true.
RepeatableNot idempotent — each call changes the row set, so re-running is not a no-op
Ships inAcrossAI Abilities Manager 0.0.34 and later

How it works

WooCommerce’s refund record and the payment provider’s refund are two separate things. Some gateways can be told to refund from within WooCommerce; many cannot, and the refund then exists only as a line in the order.

This ability deliberately does only the recording half. Attempting the gateway half would mean an assistant moving money through a payment provider, which is not a thing to do on the strength of a sentence — and doing it partially, for the gateways that support it, would be worse than not doing it at all, because the behaviour would depend on which provider the shop happens to use.

So the response states plainly that the money has not been sent. Issue it in the provider’s dashboard.

Refunding more than is left un-refunded is refused. Partial refunds accumulate, and the remaining balance is what the check runs against.

Restocking is optional and off by default, because a returned item is not always a sellable one.

Input

NameTypeRequiredWhat it is
idintegerYesOrder ID.
amountstringNoAmount to refund. Omit to refund everything not already refunded.
reasonstringNoReason, recorded on the refund.
restock_itemsbooleanNo — defaults to falsePut the refunded items back into stock.
confirmbooleanYes — must be trueThe irreversibility gate. Without it the call is refused before anything is touched.

What comes back

NameTypeWhat it is
refund_idintegerThe refund record created.
amountstringThe amount recorded.
restockedbooleanWhether items were returned to stock.
orderobjectThe order after the refund.
notestringThe statement that no money has been sent through the payment provider.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation.

Example

Ask your assistant:

Refund £24 on order 4471 — the customer returned one item.

It resolves to one call:

{
  "ability": "store/refund-order",
  "parameters": {
    "id": 4471,
    "amount": "24.00",
    "reason": "Returned item",
    "restock_items": true,
    "confirm": true
  }
}

Worth knowing

  • No money is sent. Issue the refund in the payment provider’s dashboard as well.
  • Refunding more than remains un-refunded is refused.
  • Restocking is off by default — a returned item is not always sellable.
  • The refund record cannot be removed from here.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading