I have multiple items in my order. How can I add item status and its tracking information for that order in My Account Orders?

I am using this to get orders

$_orders = $block->getOrders();

And for order status I do

$_order->getStatusLabel();

How to get the item status and its tracking information.

enter image description here

Like I have to show the

1) item status which I have hardcoded right now as Shipped and

2) item tracking information.

I have found Item.php which have this function

public function getStatus()
{
    return $this->getStatusName($this->getStatusId());
}

Is this php class ? How can I call this function in my phtml?

有帮助吗?

解决方案

You can get the status of each individual item using the following:

foreach ($_order->getAllItems() as $item) {
    echo $item->getStatus();
}

其他提示

Please change

$_order->getStatusLabel();

to

$_order->getStatus();
许可以下: CC-BY-SA归因
scroll top