Skip to content

Commit cbbc584

Browse files
author
developer19
committed
Fixes to remove space when only one country in dropdown on both cart & checkout section
1 parent 836f5e6 commit cbbc584

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

app/code/Magento/Checkout/Block/Cart/LayoutProcessor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ public function process($jsLayout)
108108
'country_id' => $this->countryCollection->loadByStore()->toOptionArray(),
109109
'region_id' => $this->regionCollection->addAllowedCountriesFilter()->toOptionArray(),
110110
];
111+
$layoutdata = $jsLayout['components']['checkoutProvider']['dictionaries']['country_id'];
112+
if(count( $layoutdata )==2 && $layoutdata[0]['value']==''){
113+
unset($jsLayout['components']['checkoutProvider']['dictionaries']['country_id'][0] );
114+
}
111115
}
112116

113117
if (isset($jsLayout['components']['block-summary']['children']['block-shipping']['children']

app/code/Magento/Checkout/Block/Checkout/DirectoryDataProcessor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ public function process($jsLayout)
7777
'country_id' => $this->getCountryOptions(),
7878
'region_id' => $this->getRegionOptions(),
7979
];
80+
$layoutdata = $jsLayout['components']['checkoutProvider']['dictionaries']['country_id'];
81+
if(count( $layoutdata )==2 && $layoutdata[0]['value']==''){
82+
unset($jsLayout['components']['checkoutProvider']['dictionaries']['country_id'][0] );
83+
}
8084
}
8185

8286
return $jsLayout;

0 commit comments

Comments
 (0)