Remove commas from WooCommerce checkout addresses fields

You can remove/replace comas from address_1 and address_2 billing and shipping fields with the following, once order is submitted (before saving data):

// Checkout/Order: Remove/replace comas from adresses fields
add_action('woocommerce_checkout_create_order', 'remove_comas_from_address_fields', 10, 2 );
function remove_comas_from_address_fields( $order, $data ) {
    $replacement="";

    if ( $billing_address_1 = $order->get_billing_address_1() ) {
        $order->set_billing_address_1( str_replace( ',', $replacement, $billing_address_1 ) );
    }

    if ( $billing_address_2 = $order->get_billing_address_2() ) {
        $order->set_billing_address_2( str_replace( ',', $replacement, $billing_address_2 ) );
    }

    if ( $shipping_address_1 = $order->get_shipping_address_1() ) {
        $order->set_shipping_address_1( str_replace( ',', $replacement, $shipping_address_1 ) );
    }

    if ( $shipping_address_2 = $order->get_shipping_address_2() ) {
        $order->set_shipping_address_2( str_replace( ',', $replacement, $shipping_address_2 ) );
    }
}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

If you wish, you can also keep your answer code at the same time. This way everything will be secure in case of manipulation.