Post by WhoKnowsWhereFoodIs » Sun May 19, 2019 11:05 pm

I am editing /template/checkout/confirm.twig in my theme and need to output the checkout total (subtotal, shipping, taxes) as a numerical value only in a new element for some custom conversion tracking.

If i use {{total.text}} it outputs the value + currency. I have attempted to edit /controller/checkout/confirm.php to make the number itself available but I'm afraid I've just been making mistakes and get a server error.

I've been totally fine pulling {{ product.product_id }} and other variables. It's just the checkout totals numerical value that escapes me.

Is there an easy twig reference for this or does anyone have some code I can add to the controller to construct one which works?

Thank you humans :D


Posts

Joined
Sun May 19, 2019 10:45 pm

Post by thekrotek » Mon May 20, 2019 4:14 pm

You could simply strip the currency symbol from the text value with PHP, but somebody decided to use TWIG, so... Short version: every total returns already formatted value, so you need to edit controller, not template file.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am

Who is online

Users browsing this forum: Baidu [Spider], edkny, pprmkr, Semrush [Bot] and 18 guests