These all are tested at my end so you can just copy and pasted code at your end

Remove taxonomy slug from product category

function custom_remove_taxonomy_slug($taxonomy_link, $term, $taxonomy) {
    if ($taxonomy === 'product_cat') { // Replace 'your_taxonomy' with the name of your taxonomy
        $taxonomy_link = str_replace('/product-category/', '/', $taxonomy_link); // Adjust the path accordingly
    return $taxonomy_link;

add_filter('term_link', 'custom_remove_taxonomy_slug', 10, 3);

Add rewrite rule for product_cat as may be it goes to 404

function custom_rewrite_rules() {
    add_rewrite_rule('^([^/]+)/?$', 'index.php?product_cat=$matches[1]', 'top');
add_action('init', 'custom_rewrite_rules');