For Magento 2 How Can I Get Order Item Name And Qty From A Given Order

How can I get order item name,price and qty from a Magento 2 Order

like Magento 1.X you can use “getAllItems” method to retrieve all items and then get name,price and qty of each item.

foreach ($order->getAllItems() as $item) {
    $name = $item->getName();
    $price = $item->getPrice();
    $qty = $item->getQtyOrdered();
}
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments