Magento get order shipping method title

Magento get order shipping method title

July 19, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento get order shipping method title

Retrieving Shipping Method Title from Magento Orders

When an order is placed successfully in your Magento store, you might need to retrieve not only the shipping method code but also its corresponding title or description. The default getShippingMethod() call will provide the method code used for the shipment, but it won’t give you the human-readable name associated with that carrier.

To fetch the shipping method title from an order object in Magento, you’ll need to work with Magento’s core models and resources:

// Load your order by increment ID
$iOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$oOrder = Mage::getModel('sales/order')->loadByIncrementId($iOrderId);

// Extract the shipping method code
$shippingMethodCode = $oOrder->getShippingMethod();

// Create a new carrier object based on the method code
$carrierObject = Mage::getModel('shipping/carrier_' . str_replace('-', '_', $shippingMethodCode));

// Get the carrier title
$carrierTitle = $carrierObject->getConfigData('title');

// Optionally, you can also get the description of the shipping method
$description = $carrierObject->getConfigData('description');

// Display the data
echo "Shipping Method Code: {$shippingMethodCode}<br>";
echo "Shipping Method Title: {$carrierTitle}<br>";
echo "Description: {$description}";

In this example, we are using Magento’s built-in shipping carrier models to retrieve the title and description of a specific carrier method. The key is to load the correct carrier model based on the shipping method code from your order.

Remember that you may need to replace 'shipping/carrier_' . str_replace('-', '_', $shippingMethodCode) with the appropriate namespace if you’re using custom carriers or extensions like Laravel Company’s Custom Shipping Carrier extension which provides advanced carrier management functionality.

If you find that the above code doesn’t work perfectly for your use case, consider looking into Magento’s core methods related to shipping carriers and configurations. The official Magento documentation can be a great resource: Magento Developers Guide - Shipping.

It’s always important to test your code thoroughly in different scenarios, especially when dealing with shipping methods that might have custom or third-party implementations.

In conclusion, retrieving the shipping method title from a Magento order involves loading the appropriate carrier object and accessing its configuration data for ‘title’ and ‘description’. This process requires understanding how Magento manages shipping carriers and their configurations. Be sure to test your code in various environments to ensure it works as expected with different shipping methods and carriers.

If you found this information helpful, don’t forget to explore Laravel Company’s blog for more in-depth tutorials on Magento development and e-commerce best practices.

Checkout Configuration Orders

Our network