Only selected product can be sell only in specific countries in WooCommerce

For my shop, I have some restrictions for the USA only. So I can only sell a selected product in the USA(But those products are allowed to sell around the world).

for example if $products_ids = array(312, 517); are the product ids that mean this product are allowed to sell in the USA. other products are restricted.

My code is working but it removes all cart items. also, it's not allowed to add_to_cart those selected products.

What I am doing wrong please help.

add_action( 'woocommerce_before_calculate_totals', 'removing_items_from_cart', 10, 1 );
function removing_items_from_cart( $cart ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    $custome_shipping_country = WC()->customer->get_shipping_country();

    if( empty($custome_shipping_country) ){
        $package = WC()->shipping->get_packages()[0];
        if( ! isset($package['destination']['country']) ) return;
        $custome_shipping_country = $package['destination']['country'];
    }

    // Only for NON USA customers
    if( $custome_shipping_country != 'US' ) return;

    //Product IDs (USA ONLY)
    $products_ids = array(312, 517);

    //checking each cart item
    $allow= false;
    foreach( $cart->get_cart() as $cart_item_key => $cart_item ){
        if( !in_array( $cart_item['data']->get_id(), $products_ids ) ){
             $allow= true;
             $cart->remove_cart_item( $cart_item_key );
        }
    }
    
    if( $allow){
         wc_clear_notices();
         wc_add_notice('Some products are not shippable for USA.', 'notice');
    }
}