Skip to content

Commit

Permalink
fix: style billing form to be more compact (#868)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelfulford authored Apr 9, 2020
1 parent 6c6d9bf commit c99a3fd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions newspack-theme/inc/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,16 @@ function newspack_woocommerce_wrapper_after() {
}
}
add_action( 'woocommerce_after_main_content', 'newspack_woocommerce_wrapper_after' );

/**
* Replace .form-row-wide classes with classes to style fields narrower.
*/
function newspack_checkout_fields_styling( $fields ) {
$fields['billing']['billing_city']['class'][0] = 'form-row-first';
$fields['billing']['billing_postcode']['class'][0] = 'form-row-first';
$fields['billing']['billing_state']['class'][0] = 'form-row-last';
$fields['billing']['billing_phone']['class'][0] = 'form-row-last';
return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'newspack_checkout_fields_styling', 9999 );

4 changes: 4 additions & 0 deletions newspack-theme/sass/plugins/woocommerce.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ a.button {
.optional {
visibility: visible;
}

&.form-row-first {
clear: left;
}
}
}

Expand Down

0 comments on commit c99a3fd

Please sign in to comment.