We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    For this, we need to create a plugin to place the billing address section before the payment methods.

    create below file at the located place and paste the below code it

    Path: app/code/Magemonkeys/Babeforepayment/etc/frontend/di.xml

    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">    
        <type name="MagentoCheckoutBlockCheckoutLayoutProcessor">
            <plugin name="move_billingaddress" type="MagemonkeysBabeforepaymentPluginBlockCheckoutLayoutProcessor"/>
        </type>
    </config>

    Create a plugin at the located place and paste the below code.

    Path: app/code/Magemonkeys/Babeforepayment/Plugin/Block/Checkout/LayoutProcessor.php

    <?php
    namespace MagemonkeysBabeforepaymentPluginBlockCheckout;
     
    use MagentoCheckoutBlockCheckoutLayoutProcessor as CheckoutLayoutProcessor;
     
    class LayoutProcessor
    {
        
        public function afterProcess(CheckoutLayoutProcessor $subject, array $jsLayout)
        {
            $paymentLayout = $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']['payment']['children'];
     
            if (isset($paymentLayout['afterMethods']['children']['billing-address-form'])) {
    
                $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']['payment']['children']['beforeMethods']['children']['billing-address-form'] = $paymentLayout['afterMethods']['children']['billing-address-form'];
     
                unset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']['payment']['children']['afterMethods']['children']['billing-address-form']);
    
            }
     
            return $jsLayout;
        }
    }

    Clear the cache and check the output.

    field_5bfb909c5ccae

      Get a Free Quote