1 2 3 4 5 6 7
<?php $pattern = sprintf( '/(\d+[\,,\.]\d{0,%s})/', wc_get_price_decimals() ); $matches = array(); preg_match( $pattern, $cart_subtotal, $matches ); $raw_subtotal = $matches[0];
You can clone a snippet to your computer for local editing. Learn more.