$extensionAttributes = $address->getExtensionAttributes();
if (!$extensionAttributes) {
$extensionAttributes = $this->extensionAttributeFactory->create(\Magento\Quote\Api\Data\AddressInterface::class);
$address->setExtensionAttributes($extensionAttributes);
}
$extensionAttributes->setMyValue('some string here');
/rest/default/V1/guest-carts/.../estimate-shipping-methodsFirst I though that the issue lies in the "Temando Shipping" module, because "estimate-shipping" POST request is initiated by it's JS file on checkout:
Temando_Shipping/js/model/shipping-rate-processor/new-address.js
And this POST includes "extension_attribute" as parameter, which looks like this on backend: https://prnt.sc/jeg9hp
But with more deeper investigation I noted that it is Magento core method:
\Magento\Quote\Api\ShipmentEstimationInterface::estimateByExtendedAddress
Which have a bug inside it's deeper implementation:
\Magento\Quote\Model\ShippingMethodManagement::getShippingMethods
Detailed info you can find here: https://prnt.sc/jegj3p
Just take a look at code debug position and right side of the picture (variable watcher).
So, the basic flow inside "getShippingMethods" is:
Add converted data to current quote shipping address. But the way how it is done is completely wrong. Since, $shippingAddress->addData() will only copy raw data to object, without restoring objects which were converted to arrays...
At the right side of the picture it is clearly displayed, that "getExtensionAttributes" from incoming and result adresses will return different types. That's the reason why during collecting totals we will get exception this time (Can not call "setMyValue" on array)
Seems like here is more easier (and dirty) way on how we can reproduce the issue, even without adding any extension attributes:
\Magento\Quote\Model\ShippingMethodManagement::getShippingMethodsThis will force run next observer:
\Temando\Shipping\Observer\SaveCheckoutFieldsObserver
Hello @IgorVitol, thank you for your report.
We've acknowledged the issue and added to our backlog.
Hi Guys,
We get the same bugs on the 2.3 version, any update or anybody have a permanent solution on this issues?
Most helpful comment
Hi Guys,
We get the same bugs on the 2.3 version, any update or anybody have a permanent solution on this issues?