WC_Order_Data_Store_CPT::get_total_refunded()
Get amount already refunded.
Method of the class: WC_Order_Data_Store_CPT{}
No Hooks.
Return
float
.
Usage
$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.
WC_Order_Data_Store_CPT::get_total_refunded() WC Order Data Store CPT::get total refunded code WC 9.4.2
public function get_total_refunded( $order ) { global $wpdb; $total = $wpdb->get_var( $wpdb->prepare( "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", $order->get_id() ) ); return floatval( $total ); }