Remove shipping estimate message on cart table in Woocommerce 3.5
Asked Answered
S

5

6

In the latest release of WooCommerce, there is a message being displayed in the cart stating the shipping cost is only an estimate.

https://www.screencast.com/t/2hSd7B27I

This doesn't make any sense when someone is using flat rate shipping and does not calculate shipping at all. Note, I don't have calculated shipping activated either. I tried to hide the message with css, however it of course, does not have a class to target.

Does anyone know how to turn this off?

Suspiration answered 4/12, 2018 at 1:4 Comment(0)
D
7

Now you can use woocommerce_shipping_estimate_html filter.

Eg.:

function shipping_estimate_html()
{
    return '';
}
add_filter('woocommerce_shipping_estimate_html', 'shipping_estimate_html');
Dareece answered 30/11, 2020 at 12:14 Comment(0)
E
4

This is something new since Woocommerce version 3.5: You will need to override via your theme (as explained on this link) the template file cart/cart-shipping.php.

From line 46 to 58, you will replace the following:

<?php if ( is_cart() ) : ?>
    <p class="woocommerce-shipping-destination">
        <?php
        if ( $formatted_destination ) {
            // Translators: $s shipping destination.
            printf( esc_html__( 'Estimate for %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' );
            $calculator_text = __( 'Change address', 'woocommerce' );
        } else {
            echo esc_html__( 'This is only an estimate. Prices will be updated during checkout.', 'woocommerce' );
        }
        ?>
    </p>
<?php endif; ?>

By this:

<?php if ( is_cart() ) : ?>
    <p class="woocommerce-shipping-destination">
        <?php
        if ( $formatted_destination ) {
            $calculator_text = __( 'Change address', 'woocommerce' );
        }
        ?>
    </p>
<?php endif; ?>

You are done… No more annoying notices.

Eccentric answered 4/12, 2018 at 1:45 Comment(0)
R
2

In the event your Template doesn't have a cart-shipping.php file, this css modification worked for me:

.cart-totals-inner .woocommerce-shipping-destination {
display: none; }
Rumelia answered 31/1, 2019 at 17:48 Comment(1)
The selector that worked for me was #shipping_method +p.woocommerce-shipping-destinationIrma
B
1

Also you can try to hide it using custom CSS:

.woocommerce-shipping-destination {visibility: hidden;}
Bisitun answered 14/7, 2020 at 4:54 Comment(1)
I've added the "display: none;" property to not only hide but remove the empty space previously occupied by that shipping textPastoral
M
1

The shortest and easiest way would be:

add_filter('woocommerce_shipping_estimate_html', '__return_false' ); 

More info here: https://developer.wordpress.org/reference/functions/__return_false/

Mistrial answered 3/11, 2023 at 8:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.