Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including
Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
The best answers are voted up and rise to the top
5 years, 4 months ago
There is any simple way in Magento2 to add custom field to Checkout? I have displayed my custom field in shipping address following by StackOverFlow tips and Magento docs. Unfortunally, Magento docs doesn't have info how to save this attribute to database.
I have moved my attributes from custom_attributes to extension_attributes, but values still is not saved in customer shipping address.
Can You give me tip how I should save my new field in custom attributes in shipping address in Customer details?
Nov 22, 2017 at 11:34
I solved my problem. Extra field in Shipping Address is saved to Quote first. So if you want to save new field in custom attributes in Customer details you have to do follow steps:
Extend Extension Attributes for
Magento\Quote\Api\Data\AddressInterface (in Magento docs)
Extend Quote table in DB about new field Create
set-shipping-information-mixin.js and move attributes to extension
attributes (in Magento docs)
Create plugin in ShippingInformationManagement before
SaveAddressInformation method. Read variable from extension attributes and save it to Quote
Overwrite "populateCustomerInfo" method in "Magento\Quote\Model\CustomerManagment and read new value from Quote and save it to custom attributes in customer object.
Nov 30, 2017 at 7:35
@K.Maliszewski, can you share your code please? I am having trouble getting the custom attributes in the ShippingInformationManagement plugin. No matter what I do it's always empty. Thanks.
Aug 10, 2022 at 4:00
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our
Accept all cookies
Necessary cookies only