WordPress at Your Fingertips
function is not described

WC_Order_Data_Store_CPT::get_total_refunded() public WC 1.0

Get amount already refunded.

{} It's a method of the class: WC_Order_Data_Store_CPT{}

No Hooks.




$WC_Order_Data_Store_CPT = new WC_Order_Data_Store_CPT();
$WC_Order_Data_Store_CPT->get_total_refunded( $order );
$order(WC_Order) (required)
Order object.

Code of WC_Order_Data_Store_CPT::get_total_refunded() WC 5.7.0

public function get_total_refunded( $order ) {
	global $wpdb;

	$total = $wpdb->get_var(
			"SELECT SUM( postmeta.meta_value )
			FROM $wpdb->postmeta AS postmeta
			INNER JOIN $wpdb->posts AS posts ON ( posts.post_type = 'shop_order_refund' AND posts.post_parent = %d )
			WHERE postmeta.meta_key = '_refund_amount'
			AND postmeta.post_id = posts.ID",

	return floatval( $total );