You’ll need to cycle through the products in the cart and, if found, delete the inapplicable methods. Your code will look something like this. You’ll need the product id of the non-deliverable item, and the exact names fo your delivery methods. Be careful not to edit the delivery method names in future or the code will break. Some php skill will be needed. Sorry, can’t debug via the forum.
add_filter( 'woocommerce_package_rates', 'custom_shipping_rates', 100, 2 );
function custom_shipping_rates( $rates, $package ) {
$cant_deliver_item_product_id = 69;
foreach( $package['contents'] as $cart_item ) {
if( $cart_item['product_id'] == $cant_deliver_item_product_id ) {
foreach( $rates as $rate_id => $rate ) {
if( 'Local Delivery' == $rate->label ) {
unset( $rates[$rate_id] );
}
if( 'National Delivery' == $rate->label ) {
unset( $rates[$rate_id] );
}
}
}
}
return $rates;
}