WordPress at Your Fingertips
function is not described

WC_Order_Data_Store_CPT::get_total_shipping_refunded() public WC 1.0

Get the total shipping 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_shipping_refunded( $order );
$order(WC_Order) (required)
Order object.

Code of WC_Order_Data_Store_CPT::get_total_shipping_refunded() WC 5.8.0

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

	$total = $wpdb->get_var(
			"SELECT SUM( order_itemmeta.meta_value )
			FROM {$wpdb->prefix}woocommerce_order_itemmeta AS order_itemmeta
			INNER JOIN $wpdb->posts AS posts ON ( posts.post_type = 'shop_order_refund' AND posts.post_parent = %d )
			INNER JOIN {$wpdb->prefix}woocommerce_order_items AS order_items ON ( order_items.order_id = posts.ID AND order_items.order_item_type = 'shipping' )
			WHERE order_itemmeta.order_item_id = order_items.order_item_id
			AND order_itemmeta.meta_key IN ('cost')",

	return abs( $total );