Skip to content

Commit

Permalink
Move country to top of form for all countries (#47375)
Browse files Browse the repository at this point in the history
* Move country to top of form for all countries

* adjust styling

* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
  • Loading branch information
senadir and github-actions committed May 13, 2024
1 parent 2db2916 commit 76a9e2e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
flex: 1 0 calc(50% - #{$gap-small}); // "flex-grow = 1" allows the input to grow to fill the space
box-sizing: border-box;

&:nth-of-type(2),
&:first-of-type {
&:first-child {
margin-top: 0;
}

&:first-child + .wc-block-components-text-input {
margin-top: 0;
}
}
Expand All @@ -38,6 +41,10 @@
.wc-block-components-country-input,
.wc-block-components-checkbox {
flex: 0 0 100%;

&:first-child {
margin-top: 0;
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/47375-add-move-country-to-first
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: update

Move country to be the first field in Checkout block.
22 changes: 11 additions & 11 deletions plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ public function __construct( AssetDataRegistry $asset_data_registry ) {
'autocapitalize' => 'none',
'index' => 0,
],
'country' => [
'label' => __( 'Country/Region', 'woocommerce' ),
'optionalLabel' => __(
'Country/Region (optional)',
'woocommerce'
),
'required' => true,
'hidden' => false,
'autocomplete' => 'country',
'index' => 1,
],
'first_name' => [
'label' => __( 'First name', 'woocommerce' ),
'optionalLabel' => __(
Expand Down Expand Up @@ -164,17 +175,6 @@ public function __construct( AssetDataRegistry $asset_data_registry ) {
'autocapitalize' => 'sentences',
'index' => 50,
],
'country' => [
'label' => __( 'Country/Region', 'woocommerce' ),
'optionalLabel' => __(
'Country/Region (optional)',
'woocommerce'
),
'required' => true,
'hidden' => false,
'autocomplete' => 'country',
'index' => 50,
],
'city' => [
'label' => __( 'City', 'woocommerce' ),
'optionalLabel' => __(
Expand Down

0 comments on commit 76a9e2e

Please sign in to comment.