The problem here is definitely the use of named functions. They will work correctly if you only have one snippet activated, but as soon as you clone and activate then run into conflict.
An easy solution is to convert to using anonymous functions, like this:
// Hide Local Pickup shipping method
add_filter( 'woocommerce_checkout_fields', function ( $fields_pickup ) {
// change below for the method
$shipping_method_pickup = 'local_pickup:23';
// change below for the list of fields. Add (or delete) the field name you want (or don’t want) to use
$hide_fields_pickup = array( 'billing_company', 'billing_country', 'billing_postcode', 'billing_address_1', 'billing_address_2', 'billing_city', 'billing_state', 'billing_wooccm11', 'billing_provin' );
$chosen_methods_pickup = WC()->session->get( 'chosen_shipping_methods' );
$chosen_shipping_pickup = $chosen_methods_pickup[0];
foreach ( $hide_fields_pickup as $field_pickup ) {
if ( $chosen_shipping_pickup == $shipping_method_pickup ) {
$fields_pickup['billing'][ $field_pickup ]['required'] = false;
$fields_pickup['billing'][ $field_pickup ]['class'][] = 'hide_pickup';
}
$fields_pickup['billing'][ $field_pickup ]['class'][] = 'billing-dynamic_pickup';
}
return $fields_pickup;
} );
// Local Pickup - hide fields
add_action( 'wp_head', function () {
if ( ! is_checkout() ) {
return;
}
?>
<style>
.hide_pickup {
display: none !important;
}
</style>
<script>
jQuery(function ($) {
if (typeof woocommerce_params === 'undefined') {
return false
}
$(document).on('change', '#shipping_method input[type="radio"]', function () {
// change local_pickup:4 accordingly
$('.billing-dynamic_pickup').toggleClass('hide_pickup', this.value == 'local_pickup:23')
})
})
</script>
<?php
}, 999 );