Automattic\WooCommerce\Internal
RestApiParameterUtil::adjust_taxes_for_create_refund_request_line_item
Adjust the taxes array from a line item in a refund request, see adjust_create_refund_parameters.
Method of the class: RestApiParameterUtil{}
No Hooks.
Returns
Array. The adjusted array.
Usage
$result = RestApiParameterUtil::adjust_taxes_for_create_refund_request_line_item( $taxes_array );
- $taxes_array(array) (required)
- The array to adjust.
RestApiParameterUtil::adjust_taxes_for_create_refund_request_line_item() RestApiParameterUtil::adjust taxes for create refund request line item code WC 10.7.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;
}