I am trying to replace billing country class from "form-row-wide" to "form-row-first" in both checkout and in My account page but it’s not working.
here is the code I am using
/*replace country class form-row-wide to form-row-first*/
add_filter( 'woocommerce_default_address_fields' , 'country_class_change', 9999 );
function country_class_change( $fields ) {
$fields['billing']['billing_country']['class'][0] = 'my-field-class form-row-first';
return $fields;
}
I used earlier the filter "woocommerce_checkout_fields" but that only worked in the checkout not in My Account page. How to do for both. whats wrong with the code?
2
Answers
I was able to do it with below code
You’ll need to change the Woocommerce template structure files. The form-row-wide class appears in a number of Woocommerce files. Simply change the markup to add any classes in your Woocommerce custom theme i.e
woocommerce/auth/form-login.php
woocommerce/cart/shipping-calculator.php
woocommerce/checkout/form-billing.php
woocommerce/myaccount/form-edit-account.php
woocommerce/myaccount/form-login.php