Skip to content

Commit

Permalink
Fix issue with comma separators
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemd24 committed Aug 14, 2024
1 parent fe41b5b commit 40a068a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Shipping/ZoneMethodsParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ protected function get_flat_rate_method_rate( object $method ): ?float {
$rate = null;

$flat_cost = 0;
$cost = $method->get_option( 'cost' );
$locale = localeconv();
$decimals = [ wc_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'], ',' ];
$cost = str_replace( $decimals, '.', $method->get_option( 'cost' ) );
// Check if the cost is a numeric value (and not null or a math expression).
if ( is_numeric( $cost ) ) {
$flat_cost = (float) $cost;
Expand Down

0 comments on commit 40a068a

Please sign in to comment.