Uncheck “Restock Refunded Items” by Default in WooCommerce Refunds
When you process a refund in WooCommerce, the “Restock refunded items” checkbox is ticked by default. If your staff isn’t paying attention, refunded items get added back to inventory automatically, even when the products were never returned. For digital goods, services, or lost packages, this quietly corrupts your stock counts.
WooCommerce exposes a filter called woocommerce_restock_refunded_items that controls the default state of that checkbox in the admin order refund UI. The filter lives in woocommerce/includes/admin/meta-boxes/views/html-order-items.php and accepts a boolean. Return false and the box loads unchecked, forcing staff to explicitly opt in to restocking.
This is a one-liner. Drop it in your child theme’s functions.php or a custom plugin.
/**
* Default the "Restock refunded items" checkbox to unchecked
* in the WooCommerce admin order refund UI.
*
* Forces staff to explicitly opt in to restocking instead of
* silently adding refunded items back to inventory.
*
* Filter source: woocommerce/includes/admin/meta-boxes/views/html-order-items.php
*/
add_filter( 'woocommerce_restock_refunded_items', '__return_false' );
That’s it. The checkbox will now appear unchecked every time the refund panel loads. Staff can still tick it manually when a customer actually returns the item, but it no longer happens by accident.
When This Snippet Makes Sense
Stores that sell physical products customers always return on refund probably want to leave the default alone. The snippet is built for the opposite scenario: shops where refunds usually don’t involve a returned product.
- Digital downloads, software licenses, online courses, memberships
- Services and bookings where there’s no physical item to restock
- Event tickets and ticketed experiences
- Lost or damaged shipments where the goods never come back
- Stores handling chargebacks and disputed orders
- Made-to-order or custom products that can’t be resold
Anywhere the default behavior is wrong more often than it’s right, flipping it saves cleanup work later.
What This Snippet Does Not Do
The filter only controls the visual default of the checkbox in the refund UI. Staff can still tick the box manually, and if they do, restocking proceeds as normal. There is also a known historical bug where the checkbox value could be ignored under certain conditions, so if you want a hard guarantee that no refund ever restocks inventory, you need to block the underlying server-side action too.
WooCommerce runs every refund-triggered restock through wc_restock_refunded_items() in wc-order-functions.php, which calls apply_filters( 'woocommerce_can_restock_refunded_items', true, $order, $refunded_line_items ) as the gate. Return false there and no refund will ever increase stock, regardless of what the checkbox says.
/**
* Hard lockdown: prevent any refund from restocking items,
* regardless of the "Restock refunded items" checkbox state.
*
* Runs server-side inside wc_restock_refunded_items(), so it catches
* programmatic refunds and any UI edge cases too.
*/
add_filter( 'woocommerce_can_restock_refunded_items', '__return_false' );
Stack this on top of the UI default filter only if you genuinely never want WooCommerce to touch inventory on refund. For most stores, just flipping the checkbox default is enough, since it preserves the manual override for the cases where it’s warranted.
Verification
- Open any order in WooCommerce > Orders
- Click Refund
- Confirm the “Restock refunded items” checkbox at the bottom of the refund panel loads unchecked
- Process a partial refund without ticking the box and confirm the product’s stock quantity does not change
Need Help?
Learn how to add custom code to WordPress or reach out for custom development help.
About the Author
More Code Snippets
-
Reorder the Columns on the WooCommerce Orders List
Put your WooCommerce orders list columns in whatever order works…
-
Set the Default Country on WooCommerce Checkout
Pre-fill the WooCommerce checkout country (and optionally state) dropdown with…
-
Bulk Delete Expired Unused WooCommerce Coupons (Batched, Safe)
One-time bulk cleanup utility for stores with thousands of expired,…