- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2022
10:26 AM
04-21-2022
10:26 AM
magento 2 add span tag in price
I am facing an issue with Magento 2 checkout success page.
I have added API for SMS to receive the final SMS about the order and when SMS is received it's showing the "span" tag around the price like below
3 5111 SHJ
<span class="price">3 AED</span> pos
Balance: 0
my line of code is:
$textMsg[] = $formatPrice->currency($order->getGrandTotal()).' '." pos ". $order->getPayment()->getCcStatus();
Labels:
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2022
05:13 AM
04-25-2022
05:13 AM
Re: magento 2 add span tag in price
Hi,
You can use the observer "checkout_onepage_controller_success_action" and get grandtotal of the order.
this will not return you the html.
/** * Create an order in Companyname when order status match the statuses in the backend * * @param EventObserver $observer * @return void */ public function execute(EventObserver $observer){ $order = $observer->getEvent()->getOrder(); $shipping_method = $order->getShippingMethod(); $order_status = $order->getStatus(); $orderTotal = $order->getGrandTotal(); if($order_status == 'processing'){ // use your custtom api } }
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2022
11:15 AM
04-25-2022
11:15 AM
Re: magento 2 add span tag in price
Hello @AsifJalil ,
try by replacing that with below code :
$textMsg[] = strip_tags($formatPrice->currency($order->getGrandTotal())).' '." pos ". $order->getPayment()->getCcStatus();
Let me know if it works for you.
Problem Solved ? Click on 'Kudos' & Accept as Solution !

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2022
11:15 PM
05-02-2022
11:15 PM
Re: magento 2 add span tag in price
Check this out for soluion : https://magento.stackexchange.com/questions/355107/magento-2-add-span-tag-in-priceCostco Employee Site Login