1

We would like to change the position of My billing and shipping address are the same section to the top of the payment methods section.

Please refer attached screen shot and advise? enter image description here

  • 1
    you can't make shipping and billing address out of payment group!! but yes you can change withing payment group means before payment methods listing you can display shipping address – Rutvee Sojitra May 31 at 6:25
  • hi @RutveeSojitra thank you for suggestion. i tried and found solution for this. thanks – NIPPU May 31 at 10:52
0

Found solution with help of @steros answer & tried in local instance its working as expected.

app/code/Nagaraju/ReorderBillingForm/etc/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="reorder-billing-form" type="Nagaraju\ReorderBillingForm\Model\Checkout\LayoutProcessorPlugin" sortOrder="25"/>
   </type>
</config>

app/code/Nagaraju/ReorderBillingForm/Model/Checkout/LayoutProcessorPlugin.php

<?php
namespace Nagaraju\ReorderBillingForm\Model\Checkout;
class LayoutProcessorPlugin
{

    /** @var \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig **/
     protected $scopeConfig;

     public function __construct(
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig   
      ){  
        $this->scopeConfig=$scopeConfig;    
       }

   /**
    * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
    * @param array $jsLayout
    * @return array
    */

   public function afterProcess(
       \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
       array $jsLayout
   )
   {
       $displayBillingAddressFlag=$this->scopeConfig->getValue('checkout/options/display_billing_address_on', \Magento\Store\Model\ScopeInterface::SCOPE_STORES);       
       if($displayBillingAddressFlag == 1){                  
         $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']['payment']['children']['beforeMethods']['children']['billing-address-form'] = $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']['payment']['children']['afterMethods']['children']['billing-address-form'];    
         unset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']['payment']['children']['afterMethods']['children']['billing-address-form']);
        return $jsLayout;
       }else{
        return $jsLayout;
      }
   }
}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.