WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Internal

RestApiUtil::adjust_taxes_for_create_refund_request_line_item() private WC 1.0

Adjust the taxes array from a line item in a refund request, see adjust_create_refund_parameters.

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

No Hooks.

Return

Array. The adjusted array.

Usage

$result = RestApiUtil::adjust_taxes_for_create_refund_request_line_item( $taxes_array );
$taxes_array(array) (required)
The array to adjust.

Code of RestApiUtil::adjust_taxes_for_create_refund_request_line_item() WC 5.9.0

private static function adjust_taxes_for_create_refund_request_line_item( $taxes_array ) {
	if ( ! is_array( $taxes_array ) || empty( $taxes_array ) || self::is_associative( $taxes_array ) ) {
		return $taxes_array;
	}

	$new_array = array();
	foreach ( $taxes_array as $item ) {
		if ( ! isset( $item['id'] ) || ! isset( $item['refund_total'] ) ) {
			return $taxes_array;
		}

		$id               = $item['id'];
		$refund_total     = $item['refund_total'];
		$new_array[ $id ] = $refund_total;
	}

	return $new_array;
}