I need to add an iframe for tracking the orders, and the code needs some values like Subtotal, order id, name of every product in the order and also the quantity for each product.
I found a solution for order id and subtotal value.
<?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $orderData = $objectManager->create('Magento\Sales\Model\Order')->loadByIncrementId($block->getOrderId()); $transaction_id = $orderData->getData()['increment_id']; $amount = number_format($orderData->getData()['subtotal'],2); ?>
From getData() function you can retrieve informations like, subtotal, customer email, order id, status of the order, store id, shipping description, etc.
But nothing about the products, like name, sku, quantity, description etc.
How can I retrieve this information, the list of all products name and quantity of each product?