I'm checking each order line.

If the line was ordered, I have to do to something. If it was backordered, I will have to do something different. Like this:

private function myFunction($order){
    $orderItems = $order->getAllVisibleItems();

    foreach($orderItems as $item) {
        $product = Mage::getModel('catalog/product')->load($item->getProductId());

        if( $item was ordered )
        elseif( $item was backordered ) 



I've already tried this post but it doesn't work.

How can I check both scenarios?


You can try Below code

Assuming $_product is your product object.

    <?php $product_inventory = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product) ?>
    <?php if($product_inventory->getBackorders() == 1 || $product_inventory->getBackorders() == 2): ?>
    <?php echo $this->__('Back Ordered') endif; ?>

You can also refer to this solution for More Detail

Hope it Helps.

| improve this answer | |
  • Doesn't work. The solution must be based on order to know if the product was backorder when the order was placed. – Alejandro Araujo Jul 31 '19 at 13:25

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.