I have already followed the method to make the checkout fields optional with the codes below. However, I found that the alert to fill in address field jumped out when the non-login user submit the order.
add_filter( 'woocommerce_default_address_fields' , 'custom_override_default_address_fields' );
function custom_override_default_address_fields($address_fields) {
$address_fields['first_name']['required'] = false;
$address_fields['last_name']['required'] = false;
$address_fields['address_1']['required'] = false;
$address_fields['address_1']['placeholder'] = '';
$address_fields['address_2']['required'] = false;
$address_fields['address_2']['placeholder'] = '';
$address_fields['postcode']['required'] = false;
$address_fields['city']['required'] = false;
return $address_fields;
}
By the way, I also tried to make the billing and shipping fields optional separately as the method in the link WooCommerce: Disabling checkout fields with a filter hook.