How are partial refunds stored in the WooCommerce Database?

Posted by Editorial Staff | Updated on

In this example, We have shared how are partial refunds stored in the WooCommerce Database?

Partial refund orders are stored in database like normal ones: In wp_posts table with a 'post_type' = 'shop_order_refund' and a 'post_parent' = order_ID (number), where the order_ID is the reference to the original 'shop_order'.

To find out which one of this refunds are partial, you need the _refund_amount amount value that you can find under wp_post_meta for this 'refund_order' and his corresponding 'shop_order' with the _order_total value too:

if ( 'refund_order' => _refund_amount ) != ( 'shop_order' => _order_total ) : then it’s partial.

if ( 'refund_order' => _refund_amount ) == ( 'shop_order' => _order_total ) : then it’s normal (not partial).


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers