Strip the currency symbol from non-price entry in totals (i.e. reward points)



define the fee within PrepareTotals()

and set

$totals[$sortOrder][] = array('notACurrency' => true);

In cases where the currency symbol needs to be manually stripped out, this code can be used:

$amt = $tmpPdfTotalAmount['amount'];
$cleanString = preg_replace('/([^0-9\.,])/i', '', $amt);
$onlyNumbersString = preg_replace('/([^0-9])/i', '', $amt);
$separatorsCountToBeErased = strlen($cleanString) - strlen($onlyNumbersString) - 1;
$stringWithCommaOrDot = preg_replace('/([,\.])/', '', $cleanString, $separatorsCountToBeErased);
$removedThousendSeparator = preg_replace('/(\.|,)(?=[0-9]{3,}$)/', '',  $stringWithCommaOrDot);
$tmpTotalAmount = str_replace(',', '.', $removedThousendSeparator);

Still need help? Contact Us Contact Us