• Resolved seaforth

    (@seaforth)


    I am working on a WooCommerce shop that does not charge for shipping (it sells courses). As a result, the message “Shipping costs updated” every time the cart is changed is very distracting and makes no sense.

    On the other hand messages like “Cart updated” are very helpful.

    Is there a way to get rid of the message about Shipping charges specifically?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Stef

    (@serafinnyc)

    The best way to do this is to simply tag each of your products as Virtual.

    Here’s a Loom on how to do that.

    Thread Starter seaforth

    (@seaforth)

    Thank you! That’s great.

    I had set most of the courses up that way previously. But the course I noticed the message on happens to have two options so it’s a variable product.

    When Variable product is selected it seems that I no longer have an option to set it as a virtual product.

    Is it possible to have a variable, virtual product?

    Thanks

    In shortcodes/class-wc-shortcode-cart.php we find

    wc_add_notice( __( 'Shipping costs updated.', 'woocommerce' ), 'notice' );
    In includes/wc-notice-functions.php we find, in the wc_add_notice function
    // Backward compatibility.
    if ( 'success' === $notice_type ) {
        $message = apply_filters( 'woocommerce_add_message', $message );
    }

    $message = apply_filters( ‘woocommerce_add_’ . $notice_type, $message );
    So instead of using the woocommerce_add_message filter hook you can use the woocommerce_add_”$notice_type” filter hook. Where you will then compare the notice message, if this is sufficient, we return false.

    So you get: (add below code in your active theme’s function.php

    function ahirwp_filter_woocommerce_add_notice ( $message ) {
        // Equal to (Must be exactly the same).
        // If the message is displayed in another language, adjust where necessary!
        if ( $message == 'Shipping costs updated.' ) {
            return false;
        }   
        
        return $message;
    }
    add_filter( 'woocommerce_add_notice', 'ahirwp_filter_woocommerce_add_notice', 10, 1 );

    Thanks
    Ahir Hemant

    Stef

    (@serafinnyc)

    When Variable product is selected it seems that I no longer have an option to set it as a virtual product.

    Is it possible to have a variable, virtual product?

    Yes, you will do the exact same thing. Both Virtual and Download are available on any variation. Make sure you have the checkmark “used for variations” checked after adding your attributes.

    Stef

    (@serafinnyc)

    @hemant-ahir Are you sure you’re in the right place?

    Hello there,

    If you would like to hide the store message box on the checkout, refer to this forum thread

    Hope this provides clarity.

    Hi @seaforth

    We’ve not heard back from you in a while, so I’m marking this thread as resolved. If you have further questions, please feel free to open a new topic.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to hide “Shipping Cost Updated” message in Cart?’ is closed to new replies.