0

I have created a custom checkbox on checkout page using layout processor. Now I want to save its value in db and then retrieve in sales order admin view. Please help. screenshot=> https://nimb.ws/bx2uq4 Layout Processor file:

<?php
namespace Aalogics\CheckoutFields\Model\Plugin\Checkout;
class LayoutProcessor
{
    /**
     * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
     * @param array $jsLayout
     * @return array
     */
    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']['delivery_label'] = [
            'component' => 'Magento_Ui/js/form/element/abstract',
            'config' => [
                'customScope' => 'shippingAddress.custom_attributes',
                'template' => 'ui/form/field',
                'elementTmpl' => 'ui/form/element/checkbox',
            ],
            'dataScope' => 'shippingAddress.custom_attributes.delivery_label',
            'description' => __('Click here if you would like your delivery White or Plain label'),
            'provider' => 'checkoutProvider',
            'visible' => true,
            'validation' => [
                'required-entry' => false,
            ],
            'sortOrder' => 250,
            'id' => 'delivery_label'
        ];


        return $jsLayout;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.