Thread Starter
3light
(@3light)
Rollback to 11.1.0 fix it temporarely.. what i found out, we hide the shipping country by following code in the functions.php:
add_filter( ‘woocommerce_billing_fields’, ‘modulo_remove_billing_name’ );
function modulo_remove_billing_name( $fields ) {
unset( $fields[ 'billing_name' ] );
return $fields;
}
add_filter( ‘woocommerce_default_address_fields’, ‘modulo_remove_state’ );
function modulo_remove_state( $fields ) {
unset( $fields[ 'state' ] );
return $fields;
}
add_filter(‘woocommerce_billing_fields’,’wpb_custom_billing_fields’);
// remove some fields from billing form
// ref – https://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
function wpb_custom_billing_fields( $fields = array() ) {
unset($fields['billing_state']);
unset($fields['billing_country']);
unset($fields['billing_email']);
unset($fields['billing_address_2']);
return $fields;
}
Thread Starter
3light
(@3light)
Finaly i solved it with this code:
In CSS
/* Hide Fields in checkout */ billing_country_field, billing_state_field, billing_address_2_field, billing_email_field {
display: none !important;
}
And then in functions.php
add_filter( ‘woocommerce_checkout_fields’ , ‘flatsome_custom_clean_checkout_fields’ );
function flatsome_custom_clean_checkout_fields( $fields ) {
// 1. Rechnungsland optional machen
if ( isset( $fields[‘billing’][‘billing_country’] ) ) {
$fields[‘billing’][‘billing_country’][‘required’] = false;
}
// 2. Bundesland / Kanton optional machen
if ( isset( $fields[‘billing’][‘billing_state’] ) ) {
$fields[‘billing’][‘billing_state’][‘required’] = false;
}
// 3. Adresse Zeile 2 optional machen
if ( isset( $fields[‘billing’][‘billing_address_2’] ) ) {
$fields[‘billing’][‘billing_address_2’][‘required’] = false;
}
// 4. E-Mail optional machen (Falls du sie komplett ausblenden willst)
if ( isset( $fields[‘billing’][‘billing_email’] ) ) {
$fields[‘billing’][‘billing_email’][‘required’] = false;
}
return $fields;
}
Thanks for sharing the details and your fix. This is a change in 11.2.0: checkout fields removed with a snippet are now sent as empty values when the order review updates, so the country ends up empty and the address check fails. The same cause showed up in another thread: https://wordpress.org/support/topic/shipping-method-disappears-in-classic-checkout-after-woocommerce-11-2-0/, and we’re looking into restoring the old behaviour. Hiding the fields with CSS and making them optional, as you did, is a good workaround until then.