Merge pull request #20212 from rnaby/240518-225308-wc-core-functions-wc_remove_number_precision_deep
wc_remove_number_precision_deep logic simplified
This commit is contained in:
commit
2a10ef31fa
|
@ -1604,16 +1604,17 @@ function wc_add_number_precision_deep( $value, $round = true ) {
|
||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
* @param array $value Number to add precision to.
|
* @param array $value Number to add precision to.
|
||||||
* @return int
|
* @return int|array
|
||||||
*/
|
*/
|
||||||
function wc_remove_number_precision_deep( $value ) {
|
function wc_remove_number_precision_deep( $value ) {
|
||||||
if ( is_array( $value ) ) {
|
if ( ! is_array( $value ) ) {
|
||||||
foreach ( $value as $key => $subvalue ) {
|
return wc_remove_number_precision( $value );
|
||||||
$value[ $key ] = wc_remove_number_precision_deep( $subvalue );
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$value = wc_remove_number_precision( $value );
|
foreach ( $value as $key => $sub_value ) {
|
||||||
|
$value[ $key ] = wc_remove_number_precision_deep( $sub_value );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue