I am facing an issue with Magento 2 checkout success page. I have added API for SMS to receive final SMS about the order and when SMS is received its showing the "span" stage around the price like below

3 51151 SHJ
**<span class="price">3 AED</span> pos**
Balance: 0

my line of code is:

$textMsg[] = $formatPrice->currency($order->getGrandTotal()).' '." pos ". $order->getPayment()->getCcStatus();

1 Answer 1


I assume that the instance of your $formatPrice variable is Magento\Framework\Pricing\Helper\Data

The currency function accepts 3 parameters

public function currency($value, $format = true, $includeContainer = true)
    return $format
        ? $this->priceCurrency->convertAndFormat($value, $includeContainer)
        : $this->priceCurrency->convert($value);

In order to remove the span element, just do this

$formatPrice->currency($order->getGrandTotal(), true, false)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.