2026 Executive BenchmarkMid-Market Enterprise Modernization: How leaders across unify Commerce, Odoo ERP & AI in 90 days.
MAGENTO COMMERCE

GET ORDER DETAILS FROM ORDER ID IN MAGENTO :

To Get real order ID from order increment id in Magento: lets assume your order increment id is # $orderIncrementId = 10001222; $orderId = Mage::getModel('sales/order') ->loadByInc...

Akshar Group Technologies
Dec 25, 2020
1 min read
Verified Source

To Get real order ID from order increment id in Magento: lets assume your order increment id is #

php
<script>
$orderIncrementId = 10001222;
$orderId = Mage::getModel('sales/order')
->loadByIncrementId($orderIncrementId)
->getEntityId();
</script>
You can get order details by order increment ID as follow:
php
<script>
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
</script>
If you know the real order ID you can get order details by using following code:
php
<script>
$order = Mage::getModel("sales/order")->load($orderId);
</script>

To get order total value:
<script>
$orderTotalValue = number_format ($order->getGrandTotal(), 2, '.' , $thousands_sep = '');
</script>

To get order items collection:
<script>
$orderItems = $order->getItemsCollection();
foreach ($orderItems as $item){

$product_id = $item->product_id;
$product_sku = $item->sku;
$product_price = $item->getPrice();
$product_name = $item->getName();
$_product = Mage::getModel('catalog/product')->load($product_id);
$cats = $_product->getCategoryIds();
$category_id = $cats; // just get the first id
$category = Mage::getModel('catalog/category')->load($category_id);
$category_name = $category->getName();
}
</script>
To get shipping method from order:
<script>
$shipping_method = $order->getShippingMethod();
</script>
To get payment method code from order you can use following code:
<script>
$payment_method_code = $order->getPayment()->getMethodInstance()->getCode();
</script>
I hope this tutorial will help you to get order details from order ID in Magento.
Share this playbook
LET'S BUILD WHAT'S NEXT

What's Holding Your Business Back?

Tell us where you want to go, what's getting in the way, and we'll help you figure out the technology to get there.

No sales pitch. Confidential strategic advisory.