0

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?

1

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

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

Please change

$_order->getStatusLabel();

to

$_order->getStatus();
  • is $_order->getStatus() for item status ? – summu May 22 at 11:20
  • @summu, Two items are from same order? try above code and check once, what you are getting? – jafar pinjar May 22 at 11:21
  • yes and i need status for both items as well, item level status – summu May 22 at 11:22
  • I am getting order status on both item level status. – summu May 22 at 11:30
  • @summu, is it fine or issue? – jafar pinjar May 22 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.