wc_remove_number_precision_deep logic simplified
This commit is contained in:
parent
187eff6e95
commit
2725cd56d4
|
@ -1603,16 +1603,17 @@ function wc_add_number_precision_deep( $value, $round = true ) {
|
|||
*
|
||||
* @since 3.2.0
|
||||
* @param array $value Number to add precision to.
|
||||
* @return int
|
||||
* @return int|array
|
||||
*/
|
||||
function wc_remove_number_precision_deep( $value ) {
|
||||
if ( is_array( $value ) ) {
|
||||
foreach ( $value as $key => $subvalue ) {
|
||||
$value[ $key ] = wc_remove_number_precision_deep( $subvalue );
|
||||
}
|
||||
} else {
|
||||
if ( ! is_array( $value ) ) {
|
||||
$value = wc_remove_number_precision( $value );
|
||||
}
|
||||
|
||||
foreach ( $value as $key => $sub_value ) {
|
||||
$value[ $key ] = wc_remove_number_precision_deep( $sub_value );
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue