Forgot to write so we can mark the topic as solved :>
If someone need the same thing, the solution was:
add_filter('bring_shipping_rates', function( $rates ) {
$shipping_classes = [
'freeshipping',
];
$free = false;
$items = WC()->cart->get_cart();
foreach ( $items as $item ) {
$shipping_class = $item['data']->get_shipping_class();
if ( in_array( $shipping_class, $shipping_classes ) ) {
$free = true;
}
}
if ($free) {
$rates[0]['cost'] = 0;
}
return $rates;
}, 999 );
This code is placed in theme’s function.php file. Before this, shipping class needs to be created (name of the shipping class will be matched here https://prntscr.com/qgv9wf)
After that these lines are commented https://prntscr.com/qgvd6w in the wp-cart-functions.php in the woocommerce plugin