WooCommerce 9.0’s Refund API and Faster HPOS Order Searches
As WooCommerce stores grow, managing refunds and finding orders efficiently become increasingly important. WooCommerce 9.0 adds a standalone REST endpoint for listing refunds and improves order searches through High-Performance Order Storage (HPOS), with an optional experimental full-text index.
These changes affect how store teams handle payment records and locate order data, so understanding their behavior helps avoid confusion when working with refunds and custom searches.
This article explains what to know about both updates.
What’s New for Refunds and HPOS in WooCommerce 9.0?
WooCommerce 9.0 adds a standalone REST API endpoint for listing refunds and improves order searches when High-Performance Order Storage (HPOS) is enabled. Its full-text search indexes are experimental and must be enabled separately.
For you, that means two practical updates: refund listings have a standalone API route, and stores using HPOS can find orders more quickly.
The new GET /wp-json/wc/v3/refunds route lists refunds across orders, with optional date filtering. Creating a refund remains a separate operation on the existing order-specific endpoint. See the WooCommerce 9.0 release notes.
You can use that change to support tasks such as refund reporting and transaction reconciliation, while checking that connected systems handle refund records as expected.
The endpoint’s availability doesn’t mean every store needs custom code; your setup and integration needs determine whether you’ll use it.
HPOS stores order data in dedicated database tables.
With HPOS enabled, WooCommerce 9.0 improves order search performance. Optional experimental full-text indexes can further accelerate eligible searches; enable them under WooCommerce > Settings > Advanced > Features and test them on staging first.
Test searches and connected extensions on a staging site before updating production.
How the WooCommerce Refund API Works
The WooCommerce Refund API lets you manage refunds through code, using order and payment details. To create a refund, you’ll specify the order, amount, and reason, then choose whether WooCommerce should return the money through the payment gateway.
Check the order and gateway first, since not every payment method supports automatic refunds.
Refund API Basics
When you issue a refund through WooCommerce’s REST API, you create a refund record linked to an order, and you can choose whether to send the money back through the payment gateway.
The refund record stores details such as the amount, reason, and date. WooCommerce also updates the order’s refund total and status, so you can review what happened later. A refund record doesn’t always mean the customer received money: if you don’t request a gateway refund, you may need to return payment another way.
Check Refund eligibility before relying on the API. The order must contain refundable amounts, and your gateway must support refunds if you want WooCommerce to process one automatically.
Partial refunds let you return less than the full amount, such as one item’s price. Taxes and shipping may affect the available balance. Keep your records clear to avoid refunding more than the order allows.
Creating Refunds
To create a refund, send a POST request to the order’s refunds endpoint, such as /wp-json/wc/v3/orders/123/refunds. Include your API credentials and a JSON body with the refund details.
For example, set amount to the amount you want to return, and add a reason to explain the refund. To return money through the payment gateway, set api_refund to true, if the gateway supports refunds. Use false when you only need to record a manual refund. You can also set line_items to refund specific products instead of the full order.
Check the response for the new refund ID and verify the gateway outcome separately. Review the order totals to confirm the change.
The api_refund parameter controls whether WooCommerce requests a gateway refund; it does not control notification emails. Review your store’s email settings separately, and save the reason and response for your records.
Create and Manage Refunds With the API
If you need to return money for an order, WooCommerce’s REST API lets you create and manage refunds without opening the order in your dashboard. Send a POST request to an order’s refunds endpoint, then include the amount and, if needed, a reason.
You can also choose whether to restock refunded items. Check your store’s permissions before sharing API keys, and use HTTPS to support Refund API security.
To manage refunds safely:
Verify the order and refund amount, save the refund ID, and check the refund’s status through the API.
- Confirm the order ID and refund amount before sending your request.
- Save the refund ID from the response, so you can find that record later.
- Review the refund’s details through the API and verify the payment outcome with the gateway.
Keep your requests limited to the access each integration needs. If a request fails, check its response and correct the order ID, amount, or permissions before trying again.
Connect Refunds to Your Payment Gateway
Creating a refund through WooCommerce’s API doesn’t always send money back to the customer. You must also connect the refund to your payment gateway, which handles the actual transfer.
Check your gateway’s documentation to confirm how it processes refunds and whether your integration supports them.
When you create a WooCommerce refund, pass the required gateway details through the payment method’s supported refund process. Don’t assume the order’s refunded status means the gateway has returned funds.
Confirm the gateway’s response, then keep WooCommerce’s refund record aligned with the transaction.
If your gateway offers refund webhooks, follow its integration documentation and verify how it handles events and duplicate notifications before changing store records.
Finally, compare gateway activity with payment reconciliation reports, so you can verify that recorded refunds match the funds returned to customers.
Handle Refund Errors and Edge Cases
Even when your gateway processes a refund, errors can leave WooCommerce and the payment record out of sync.
Check the order notes and gateway dashboard before retrying, so you don’t issue the same refund twice.
Payment gateway errors may leave a request pending or rejected, while partial refund limits can prevent a refund that exceeds the remaining refundable amount.
- Confirm the result: Review the gateway’s transaction status and compare it with the WooCommerce order.
- Retry carefully: If the gateway confirms no refund occurred, correct the issue and retry through the order’s refund controls.
- Reconcile mismatches: If the gateway refunded money but WooCommerce didn’t update, record the transaction details and adjust the order status or contact support.
For partial refunds, track amounts already returned.
Keep clear notes for each attempt, and don’t mark an order refunded until you verify the payment record.
Why HPOS Order Searches Are Faster
With HPOS, you can search dedicated order tables instead of scanning WordPress’s general-purpose posts table.
Optimized indexes help your queries find matching orders with fewer steps. Check that your search uses HPOS tables and indexed fields to get the speed benefit.
Direct Order Table Queries
Because HPOS stores orders in dedicated tables, WooCommerce can search order fields directly instead of scanning WordPress’s general-purpose post tables and related metadata. This direct path helps you retrieve matching orders with less work, especially when your store has many records.
You can also use Query profiling to see which searches take the most time and whether your custom code is adding extra requests.
When you build or review an order lookup, keep these steps in mind:
- Use WooCommerce’s order APIs first, so your code works with HPOS and other supported storage setups.
- Narrow results with specific fields, such as status, customer ID, or date range, rather than loading every order.
- Check returned data before displaying it, and handle empty results clearly.
Direct SQL can bypass compatibility features, so use it only when you understand the table structure and can maintain the query.
Optimized HPOS Indexes
HPOS uses dedicated order tables with indexes on fields such as order status, customer ID, and date, so WooCommerce can narrow a search without checking every order row.
For you, that means an order lookup can read fewer rows, especially when your store has many orders. Indexes help most when a query filters or sorts by indexed fields.
Composite index design matters when your searches combine conditions, such as customer ID and order date. The field order in an index affects which queries can use it, so check your common filters before adding custom indexes.
Extra indexes can slow writes and take storage.
To verify a change, review Query execution plans with your database tools, then compare search times using realistic data. Don’t assume an index helps every lookup.
Test key admin searches, and keep custom database changes documented for future updates.
How to Search Orders With HPOS
How do you find an order quickly when your store uses HPOS? Start with the built-in Orders screen, where you can search by order number, customer name, or billing details.
Enter a specific term to narrow results, then check the matching records before opening one. For a more focused order search, combine a useful keyword with status filtering, such as processing or completed. This helps you locate the right order without scanning every row.
Use these steps:
- Open WooCommerce > Orders in your WordPress dashboard.
- Enter an order number, name, or email in the search field, then run the search.
- Choose a status filter if needed, and review the results.
Keep search terms specific, especially when several customers share a name. If you don’t see the order, clear filters and try another detail.
HPOS stores orders separately from posts, so use the Orders screen to search them.
Keep Custom Order Queries Compatible With HPOS
If your code searches orders directly in the posts table, update it to use WooCommerce’s order query tools, which work with HPOS and other storage setups. Replace direct SQL against wp_posts and wp_postmeta with wc_get_orders() or WC_Order_Query.
These tools let WooCommerce choose the right data store, so your extension won’t depend on where orders live.
For custom filters, use supported query arguments where possible, and check the WooCommerce developer documentation before adding a new one. If you need a query WooCommerce doesn’t support, build it through the data store interface rather than assuming orders use WordPress posts.
Treat custom query migration as a code change to test on both HPOS and legacy storage. Review scheduled tasks, reports, and admin screens too. Legacy metadata cleanup should remove only data you’ve confirmed is unused.
Combine Refund and HPOS Improvements in Your Store
Bring refund handling and HPOS changes together by testing them across the full order workflow. Check that your refund process updates order records correctly, while HPOS searches still find orders through the screens and tools your team uses. Test with real-world cases in a staging store before rolling changes out.
- Map the workflow: Place a test order, issue a full or partial refund, and confirm the order status, totals, and refund notes.
- Check compatibility: Verify custom queries, reports, and integrations against HPOS data, then confirm refunded orders appear in search results.
- Monitor after launch: Use Storewide Performance Monitoring to compare search times and spot errors. Review logs and refund records regularly.
You can add Refund Workflow Automation once these checks pass. Start with clear rules, keep a manual review path for unusual refunds, and track results before expanding automation.
Frequently Asked Questions
When Was WooCommerce 9.0 Released?
WooCommerce 9.0 was released on June 18, 2024, according to the official release notes.
Which PHP Versions Are Compatible With WooCommerce 9.0?
WooCommerce 9.0 requires PHP 7.4 or newer. Choose a PHP version that is still supported and compatible with your host, theme, and extensions, and test the upgrade on staging.
How Can I Test WooCommerce 9.0 Safely Before Upgrading?
You can test WooCommerce 9.0 safely by cloning your store to a staging site, then performing Staging site testing with your theme, plugins, checkout, and orders. Create a backup first and verify backup restoration before upgrading production.
Do Extensions Need Updates to Support WooCommerce 9.0?
Yes, you may need extension updates: Extension compatibility depends on each developer’s testing. Check extension release notes and test compatibility in staging; one failing extension can disrupt checkout.
Where Can I Find the Complete WooCommerce 9.0 Changelog?
You can find the complete WooCommerce 9.0 changelog on the official WooCommerce GitHub release page. Check the Official changelog for every change, and review the release highlights for key updates before upgrading your store.
- High-Performance Order Storage
- Refund API
- WooCommerce
About the author
Vladimir Mrkela
Senior WordPress Developer
I’m a senior WordPress developer and co-founder of Pixel Industry. I’ve spent more than 12 years building websites, custom plugins, and integrations for all kinds of projects. I enjoy working on complex architecture, solving tricky problems, and sharing what I learn along the way.