Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 856
Christian Rea Avatar asked Dec 04 '18 01:12

Christian Rea


3 Answers

Now you can use woocommerce_shipping_estimate_html filter.

Eg.:

function shipping_estimate_html()
{
    return null;
}
add_filter('woocommerce_shipping_estimate_html', 'shipping_estimate_html');
like image 136
kanlukasz Avatar answered Oct 09 '22 03:10

kanlukasz


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.

like image 38
LoicTheAztec Avatar answered Oct 09 '22 03:10

LoicTheAztec


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; }
like image 2
Prometheus Avatar answered Oct 09 '22 01:10

Prometheus