Automattic\WooCommerce\Internal
RestApiUtil::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: 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.
RestApiUtil::adjust_taxes_for_create_refund_request_line_item() RestApiUtil::adjust taxes for create refund request line item code WC 8.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; }