I posted this question: How can i get the order total value on success page easily? Magento 2.2 But it never got resolved. Unsure how to rerequest help about it. But I need to get it solved.
I am using magento 2.2.1
The page in question is using:
$block: \Magento\Checkout\Block\Onepage\Success
I am able to get the OrderID but not the grandtotal. I have tried all suggestions I have been able to recreate found on google and on this forum.
I need the grandtotal for creating a postback to the facebook pixel.
I am able to get the orderid using: $lastOrderId = $block->getOrderId();
And I have tried things like:
$lastOrderId = $block->getOrderId();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Model\Order')->load($lastOrderId);
echo "order id: ". $lastOrderId;
echo $order->getGrandTotal();
Any suggestions? Would very much appreciate some help