WordPress at Your Fingertips
function is not described

WC_Order_Data_Store_CPT::get_total_tax_refunded() public WC 1.0

Get the total tax refunded.

{} It's a 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_tax_refunded( $order );
$order(WC_Order) (required)
Order object.

Code of WC_Order_Data_Store_CPT::get_total_tax_refunded() WC 5.7.1

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

	$total = $wpdb->get_var(
		$wpdb->prepare(
			"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 = 'tax' )
			WHERE order_itemmeta.order_item_id = order_items.order_item_id
			AND order_itemmeta.meta_key IN ('tax_amount', 'shipping_tax_amount')",
			$order->get_id()
		)
	);

	return abs( $total );
}