customerSession = $customerSession; $this->orderConfig = $orderConfig; } /** * {@inheritdoc} */ public function canView(\Magento\Sales\Model\Order $order) { $customerId = $this->customerSession->getCustomerId(); $availableStatuses = $this->orderConfig->getVisibleOnFrontStatuses(); if ($order->getId() && $order->getCustomerId() && $order->getCustomerId() == $customerId && in_array($order->getStatus(), $availableStatuses, true) ) { return true; } return false; } }