Skip to content
Snippets Groups Projects
Select Git revision
  • 90de78392794f3b6b993fbf83c4e670d6bb49ab2
  • dev default protected
  • prod protected
  • 1.0.58
  • 1.0.57
  • 1.0.52
  • 1.0.56
  • 1.0.51
  • 1.0.50
  • 1.0.33
  • 1.0.32
  • 1.0.31
  • 1.0.30
  • 1.0.29
  • 1.0.28
  • 1.0.27
  • 1.0.26
  • 1.0.25
  • 1.0.24
  • 1.0.23
  • 1.0.22
  • 1.0.21
  • 1.0.20
23 results

LayoutProcessorPlugin.php

Blame
  • LayoutProcessorPlugin.php 1.74 KiB
    <?php
    namespace uafrica\Customshipping\Plugin\Checkout\Block;
    
    use Magento\Checkout\Block\Checkout\LayoutProcessor;
    
    class LayoutProcessorPlugin
    {
        /**
         * This is the Class That Allows The Field To Appear As Required On Checkout,
         * But It Does Not Save The Data To The Quote Table In The Database For The Order
         * To Be Processed Correctly In The Backend And Frontend It Works With Shipping
         * Information Management Class
         * @param LayoutProcessor $subject
         * @param array $jsLayout
         * @return array
         */
        public function afterProcess(
            LayoutProcessor $subject,
            array  $jsLayout
        ): array
        {
    
            $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
            ['shippingAddress']['children']['shipping-address-fieldset']['children']['suburb'] = [
                'component' => 'Magento_Ui/js/form/element/textarea',
                'config' => [
                    'customScope' => 'shippingAddress.extension_attributes',
                    'customEntry' => null,
                    'template' => 'ui/form/field',
                    'elementTmpl' => 'ui/form/element/input',
                    'options' => [],
                    'tooltip' => [
                        'description' => __('Necessary for shipping.')
                    ],
                    'id' => 'suburb'
                ],
                'dataScope' => 'shippingAddress.extension_attributes.suburb',
                'label' => 'Suburb',
                'provider' => 'checkoutProvider',
                'visible' => true,
                'validation' => [
                    'required-entry' => true
                ],
                'sortOrder' => 110,
                /*'customEntry' => null,*/
                'id' => 'suburb'
            ];
    
            return $jsLayout;
        }
    }