To Get Current Status of Ordered Items.

To get current status of ordered items in Recent orders and Order History of My Account.

<?php if ($block->getOrder()->hasInvoices()): ?>
    <?php $key = 0; ?>
    <?php foreach ($block->getOrder()->getInvoiceCollection() as $invoice): ?>
        <?php if($key == 0): ?>
            <?php if($invoice->getIsInvoicePaid() == 0): ?>
                <?= __('Pending') ?>
            <?php else: ?>
                <?= $block->escapeHtml($block->getOrder()->getStatusLabel()) ?>
            <?php endif; ?>
        <?php endif; ?>
        <?php $key++; ?>
    <?php endforeach; ?>
<?php else: ?>
    <?= $block->escapeHtml($block->getOrder()->getStatusLabel()) ?>
<?php endif; ?>

Leave a comment

Your email address will not be published. Required fields are marked *