Christian Rea
Christian Rea

Reputation: 63

Remove shipping estimate message on cart table in Woocommerce 3.5

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?

Upvotes: 6

Views: 22595

Answers (5)

kanlukasz
kanlukasz

Reputation: 1314

Now you can use woocommerce_shipping_estimate_html filter.

Eg.:

function shipping_estimate_html()
{
    return '';
}
add_filter('woocommerce_shipping_estimate_html', 'shipping_estimate_html');

Upvotes: 7

Tilo
Tilo

Reputation: 95

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/

Upvotes: 1

Also you can try to hide it using custom CSS:

.woocommerce-shipping-destination {visibility: hidden;}

Upvotes: 1

Prometheus
Prometheus

Reputation: 21

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; }

Upvotes: 2

LoicTheAztec
LoicTheAztec

Reputation: 253804

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.

Upvotes: 4

Related Questions