隐藏运输标签woocommerce

I need to hide the shipping label on my woocommerce cart page but keep it visible on the checkout page.

I have read that I can use is_cart() to target the cart specifically but it has not worked with any code that I have written in functions.php.

Does anyone know how to accomplish this?

-edit-

I have found the following code to put in functions.php:

add_filter('woocommerce_cart_shipping_method_full_label', 'remove_shipping_label', 10, 2);

function remove_shipping_label($label, $method) {
    $new_label = preg_replace('/^.+:/', '', $label);
    return $new_label;
}

Now I need to combine the code with "if ( is_cart() )" to target the cart page specifically but I haven't figured out how.

The cart page is loaded by a template in the plugin folder:

woocommerce/templates/cart/cart-shipping.php

To overridethis template you need to copy that file in your theme at:

/your_theme_folder/woocommerce/cart/cart-shipping.php

Now you can do anything with it (leave it empty even) and it will only affect the cart page. The checkout page uses a different template file to generate the shipping fields.

Source: experience + template overriding

This is what I got to work, that is to edit woocommerce shipping details template. Old question I know, and my answer is not 100% related to the question, but searching did not help me too much with this problem,so I thought I'd help anyone still looking......

In the line $pos=strpos($wherefrom,"checkout"); the checkout must be the name (slug) of your checkout page. The section that let's you choose payment methods is loaded by ajax, so all the 'is_page', 'is_checkout', etc, return blanks, so I resorted to useing the http_referrer. This is the result of way too many hours on one 'small' problem. This code goes in the cart-shipping.php file as described in Yavour's answer, and must replace the existing code between the existing <ul></ul>.

        <ul id="shipping_method">
            <?php 
            $wherefrom=wp_get_referer();
            $pos=strpos($wherefrom,"checkout");
            if ($pos!==false)
            {
                echo "<li>";
                foreach ( $available_methods as $method )
                {
                    if ($method->id==$chosen_method)
                    {
                        $mymethod=wp_kses_post(wc_cart_totals_shipping_method_label( $method ));
                    }
                }
                echo $mymethod; 
                echo "</li>";
            }
            else
            {
            ?>
                <?php foreach ( $available_methods as $method ) : ?>
                <li>
                    <input type="radio" name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>_<?php echo sanitize_title( $method->id ); ?>" value="<?php echo esc_attr( $method->id ); ?>" <?php checked( $method->id, $chosen_method ); ?> class="shipping_method" />
                    <label for="shipping_method_<?php echo $index; ?>_<?php echo sanitize_title( $method->id ); ?>"><?php echo wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ); ?></label>
                </li>
                <?php endforeach; ?>
            <?php
            }
            ?>

        </ul>
function disable_shipping_calc_on_cart( $show_shipping ) {
    if( is_cart() ) {
        return false;
    }
    return $show_shipping;
}
add_filter( 'woocommerce_cart_ready_to_calc_shipping','disable_shipping_calc_on_cart', 99 );