I tried getting the checkout fields attributes which are included with the Swissup Firecheckout ... the developer said its possible with $order->getExtensionAttributes();.

So I created some throw away code to test, like this:

$orderId = 12345;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('\Magento\Sales\Model\OrderRepository')->get($orderId);
var_dump($order->getExtensionAttributes()); // does NOT work
var_dump($order->getIncrementId()); // does work

Nothing is dumped except for the increment id of the order. I am sure the order has some checkout fields set ...

Am I missing something or whats wrong here?


  • first check var_dump($order->getData()); , you will get more data in array Commented Jan 30 at 11:51

1 Answer 1


This is the correct method to fetch the extension attributes from the order.

If you are unable to retrieve the extension attributes, it could be due to other reasons. It's possible that event/plugin/classes related to the extension attributes are not working properly.

I have followed the steps/code below and it appears to be functioning properly without any problems. I am able to obtain the correct extension attribute values with your code.


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Sales\Api\Data\OrderInterface">
        <attribute code="additional_charges1" type="decimal" />
        <attribute code="additional_charges2" type="decimal"/>


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_order_load_after">
        <observer name="sales_order_load_attribute" instance="[Namespace]\[ModuleName]\Observer\OrderLoadAfter"/>

sales_order_load_after Observer:


namespace [Namespace]\[ModuleName]\Observer;

use Magento\Framework\Event\ObserverInterface;

class OrderLoadAfter implements ObserverInterface
    protected $_orderExtension;

    public function __construct(\Magento\Sales\Api\Data\OrderExtension $orderExtension)
        $this->_orderExtension = $orderExtension;
    public function execute(\Magento\Framework\Event\Observer $observer)
        $order = $observer->getOrder();

        $extensionAttributes = $order->getExtensionAttributes();
        if ($extensionAttributes === null) {
            $extensionAttributes = $this->_orderExtension;
        $additional_charges1 = 52;
        $additional_charges2 = 51;
        $extensionAttributes->setData('additional_charges1', $additional_charges1);
        $extensionAttributes->setData('additional_charges2', $additional_charges2);

Got below response after using your code:

  protected '_data' => 
    array (size=6)
      'additional_charges1' => int 52
      'additional_charges2' => int 51
      'applied_taxes' => 
        array (size=0)
      'item_applied_taxes' => 
        array (size=0)
      'shipping_assignments' => 
        array (size=1)
          0 => 
      'payment_additional_info' => 
        array (size=1)
          0 => 
  • Thanks for you time! Is there not another way to get the values? It doesnt work in my case ... Commented Jan 30 at 8:23
  • Are you not able to get the value if we pass the field name under the getData() like this $order->getData('fieldname'); Commented Jan 30 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.