Type
magento2-module
Add a custom form to Magento 2 checkout on the first step.
magento2-module
MIT
None
None
None
None
None
Add custom form fields to Magento 2 checkout. The form will appear in first checkout step.
Form data will be set in quota
table through independent API request: /V1/carts/mine/set-order-custom-fields
. Form is available only for logged in customers. After order is placed all data are set in sales_order
table. Data are still in form after page refreshed, till cart is active.
composer require sbodak/magento2-checkout-custom-form
php bin/magento module:enable Bodak_CheckoutCustomForm
php bin/magento setup:upgrade
Api/Data/CustomFieldsInterfaces.php
Setup/InstallData.php
Observer/AddCustomFieldsToOrder.php
which save data in quota and sales tableview/frontend/layout/checkout_index_index.xml
<item name="custom-checkout-form-fieldset" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">custom-checkout-form-fields</item>
<item name="children" xsi:type="array">
[... place here new definition of your field]
</item>
</item>
Check official documentation: http://devdocs.magento.com/guides/v2.0/howdoi/checkout/checkout_form.html
view/frontend/templates/order/view/custom_fields.phtml
(for customer account) and view/adminhtml/templates/order/view/custom_fields.phtml (for admin panel)
.To remove this module run php bin/magento module:uninstall Bodak_CheckoutCustomForm
.
It will remove all data and drop columns in sales_order
and quote
tables.