magento2
magento2 copied to clipboard
Can not checkout in m2.4.3 when address has extension attribute
Preconditions (*)
- 2.4.3-p1
Steps to reproduce (*)
- Address have extension attribute
- Already reproduce this issue in default m2.4.3
Expected result (*)
- Checkout success
Actual result (*)
- Can not checkout
- Error message: Object of class Magento\Quote\Api\Data\AddressExtension could not be converted to string

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- [x] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @MaiDucQuan97. Thank you for your report. To help us process this issue please make sure that you provided the following information:
- Summary of the issue
- Information on your environment
- Steps to reproduce
- Expected and actual results
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance - upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
Please, add a comment to assign the issue: @magento I am working on this
- Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
-
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
Details
If the issue has a valid description, the labelIssue: Format is validwill be added to the issue automatically. Please, edit issue description if needed, until labelIssue: Format is validappears. -
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
Issue: Clear Descriptionlabel to the issue by yourself. -
[ ] 3. Add
Component: XXXXXlabel(s) to the ticket, indicating the components it may be related to. -
[ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! -
[ ] 5. Add label
Issue: Confirmedonce verification is complete. -
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi every body, I also got this error when I try to checkout with guest customer ( order customer that don't have any address before access checkout page ) Magento 2.4.3 have added the function to compare shipping and billing address when order is place. Checkout Process working fine if I don't make any customize.
But when I add extension_attribute to AddressInterface, the function array_diff() will cause an error because $billingData and $shippingData contain an object. class: Magento\CheckoutStaging\Plugin\GuestPaymentInformationManagementPlugin Magento\CheckoutStaging\Plugin\PaymentInformationManagementPlugin

Can you fix it asap? thank you
Is this EE version only?
I have also faced this issue on Magento EE 2.4.3. It seems to affect sites that have the CheckoutStaging module enabled (which is the default) and who are using custom extension attributes for addresses. Custom extension attributes for addresses are documented at https://devdocs.magento.com/guides/v2.4/howdoi/checkout/checkout_new_field.html, and so should be something Magento fully supports.
For anyone else facing this issue, the following patch has been working well for us (placed in the m2-hotfixes directory on cloud installations):
--- a/vendor/magento/module-checkout-staging/Plugin/GuestPaymentInformationManagementPlugin.php
+++ b/vendor/magento/module-checkout-staging/Plugin/GuestPaymentInformationManagementPlugin.php
@@ -101,7 +101,7 @@
$billingData = $this->convertAddressValueToFlatArray($billingAddress->getData());
$billingKeys = array_flip(array_keys($billingData));
$shippingData = array_intersect_key($quoteShippingAddressData, $billingKeys);
- $removeKeys = ['region_code', 'save_in_address_book'];
+ $removeKeys = ['region_code', 'save_in_address_book', 'extension_attributes'];
$billingData = array_diff_key($billingData, array_flip($removeKeys));
$difference = array_diff($billingData,$shippingData);
return empty($difference);
--- a/vendor/magento/module-checkout-staging/Plugin/PaymentInformationManagementPlugin.php
+++ b/vendor/magento/module-checkout-staging/Plugin/PaymentInformationManagementPlugin.php
@@ -117,7 +117,7 @@
$billingData = $this->convertAddressValueToFlatArray($billingAddressData);
$billingKeys = array_flip(array_keys($billingData));
$shippingData = array_intersect_key($quoteShippingAddressData, $billingKeys);
- $removeKeys = ['region_code', 'save_in_address_book'];
+ $removeKeys = ['region_code', 'save_in_address_book', 'extension_attributes'];
$billingData = array_diff_key($billingData, array_flip($removeKeys));
$difference = array_diff($billingData, $shippingData);
$sameAsBillingFlag = empty($difference);
Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
-
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
Details
If the issue has a valid description, the labelIssue: Format is validwill be added to the issue automatically. Please, edit issue description if needed, until labelIssue: Format is validappears. -
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
Issue: Clear Descriptionlabel to the issue by yourself. -
[ ] 3. Add
Component: XXXXXlabel(s) to the ticket, indicating the components it may be related to. -
[ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! -
[ ] 5. Add label
Issue: Confirmedonce verification is complete. -
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @dborishansky. Thank you for your request. I'm working on Magento instance for you.
Hi @dborishansky, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
@magento give me 2.4-develop instance
Hi @dborishansky. Thank you for your request. I'm working on Magento instance for you.
Hi @dborishansky, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
Hi @MaiDucQuan97,
Thank you for reporting the issue. However, we tried to reproduce it on Magento 2.4-develop but the address extension functionality works as expected. Steps followed to reproduce issue:
-
Added a new plugin and added the address extension attribute by following the steps given in the doc.
-
Verified the checkout functionality after adding the address extension attribute as a Guest user as well as the registered user.
-
Checkout functionality works as expected and I was able to place the order. (See the attached screenshots.)

-
We tested the address attribute extension for string and array type and it works as expected.
If the issue still persists at your end then provide the issue details in depth also provide screenshots or video, accordingly I’ll try to reproduce it again.
Thanks
@engcom-Hotel
The issue happens in the module CheckoutStaging (as pointed by @braders) when you send extension_attributes as part of Billiing Address (screen 1), OR when shipping address contains extension attributes when order is placed (screen 2).
Screen 1

Screen 2

We have same issue in Magento EE 2.4.3 For us only works if we remove "extension_attributes" key from both (billingData, shippingData)
$removeKeys = ['region_code', 'save_in_address_book', 'extension_attributes'];
$billingData = array_diff_key($billingData, array_flip($removeKeys));
$shippingData = array_diff_key($shippingData, array_flip($removeKeys));
Hi @engcom-Lima. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
-
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
Details
If the issue has a valid description, the labelIssue: Format is validwill be added to the issue automatically. Please, edit issue description if needed, until labelIssue: Format is validappears. -
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
Issue: Clear Descriptionlabel to the issue by yourself. -
[ ] 3. Add
Component: XXXXXlabel(s) to the ticket, indicating the components it may be related to. -
[ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! -
[ ] 5. Add label
Issue: Confirmedonce verification is complete. -
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @MaiDucQuan97, Thank you for reporting the issue.
I tried reproducing the issue on Magento 2.4-develop branch EE edition and I was able to reproduce the issue.
Steps followed to reproduce the issue:-
-
Install fresh Magento 2.4-develop instance EE edition
-
Add Extension attributes for
Magento\Quote\Api\Data\AddressInterface
-
Override LayoutProcessor and all other required mixins by following the official documentation
-
Try to place order from Frontend through Guest Checkout

Note: I have added unit_number in shipping data
Expected Result: User should be able to checkout successfully
Actual Result:
- Can not checkout
- Error message: Object of class Magento\Quote\Api\Data\AddressExtension could not be converted to string

Hence confirming the issue.
Thanks!
:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-2376 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Lima. Thank you for verifying the issue.
Issue Available: @engcom-Lima, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Also facing this issue in 2.4.4. It would be possible to add a check for AbstractSimpleObject and then cast it to array and json_encode it:
private function convertAddressValueToFlatArray(array $address): array
{
array_walk(
$address,
function (&$value) {
if (is_array($value) && isset($value['value'])) {
if (!is_array($value['value'])) {
$value = (string)$value['value'];
} elseif (isset($value['value'][0]['file'])) {
$value = $value['value'][0]['file'];
}
} else {
if ($value instanceof AbstractSimpleObject) {
$value = json_encode((array) $value);
}
}
}
);
return $address;
}
This way the extension attribute is converted to a string, and the values are still being compared.
@magento i'm working on it
Hi folks, any update on this ticket?
Hi All, any updates about the solution? It still happens :)
Just discovered this issue on 2.4.4 EE, does @braders patch still work as a temporary fix? Is this still a thing on 2.4.5?
Internal Team started working on this issue and solution is almost ready
A patch for you guys while waiting for updating from Magento. https://gist.github.com/trunglv/9956b6e4adb206ad304c0b00eec05a5a
Issue is already fixed in the develop branch and not reproducible anymore. Here is the commit https://github.com/magento-commerce/magento2ce/commit/b4f87e9632055d369a0a4c943dee00888c336ea4
Thanks for the update @chittima. We are closing this issue.
Thanks
Hi, @chittima I am facing the same issue on Magento 2.4.3P with guest users only and I check your commit link its shows 404 can you please share the patch with me?
Thanks
Hi @mhamzaraja Please find the commit: b4f87e9632055d369a0a4c943dee00888c336ea4