I created a custom attribute for quote and order like this:
$quote = 'quote'; $orderTable = 'sales_order'; $setup->getConnection() ->addColumn( $setup->getTable($quote), 'is_dropship', [ 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'comment' =>'Dropship Order' ] ); //Order table $setup->getConnection() ->addColumn( $setup->getTable($orderTable), 'is_dropship', [ 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'comment' =>'Dropship Order' ] ); $setup->endSetup(); then i add the custom field with checkbox type like this
Vendor/Module/Plugin/Checkout/Model/Checkout/LayoutProcessor.php
public function afterProcess( \Magento\Checkout\Block\Checkout\LayoutProcessor $subject, array $jsLayout ) { $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children'] ['shippingAddress']['children']['shipping-address-fieldset']['children']['custom_test'] = [ 'component' => 'Magento_Ui/js/form/element/abstract', 'config' => [ 'customScope' => 'shippingAddress', 'template' => 'ui/form/field', 'elementTmpl' => 'ui/form/element/checkbox', 'options' => [], 'id' => 'is_dropship', ], 'dataScope' => 'shippingAddress.is_dropship', 'label' => 'Send as dropship', 'provider' => 'checkoutProvider', 'visible' => true, 'checked' => true, 'value' => 1, 'validation' => [], 'sortOrder' => 999, 'id' => 'is_dropship' ]; return $jsLayout; } Vendor/Module/etc/frontend/di.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Checkout\Block\Checkout\LayoutProcessor"> <plugin name="vendor_add_custom_field" type="Vendor\Module\Plugin\Checkout\Model\Checkout\LayoutProcessor" sortOrder="100"/> </type> </config> Vendor/Module/etc/extension_attributes.xml
<?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\Checkout\Api\Data\ShippingInformationInterface"> <attribute code="is_dropship" type="string"/> </extension_attributes> </config> the checkbox is showing fine.
But, When I check and place the order, the value of is_order in sales_order and quote table remain NULL