How to remove add to woocommerce cart message

This topic has 6 replies, 3 voices, and was last updated 1 months, 1 weeks ago ago by Jack Richardson

  • Avatar: Hanzla Nadeem
    Hanzla Nadeem
    Participant
    October 26, 2025 at 13:11

    i want to ask how to remove add to woocommerce cart message. i have disabled add to cart button and only kept buy now button which directly takes u to checkout. so there is no need to show message (product has been add to cart). i have tried to use following code but didnt work:

    add_filter( ‘wc_add_to_cart_message_html’, ‘__return_false’ );

    Files is visible for topic creator and
    support staff only.
    5 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    October 26, 2025 at 16:37

    Hi @Hanzla Nadeem,

    Can you please try with this code instead?

    
    function filter_wc_add_to_cart_message_html( $message, $products ) {
    return '';
    };
     
    // add the filter
    add_filter( 'wc_add_to_cart_message_html', 'filter_wc_add_to_cart_message_html', 10, 2 );
    

    Hope it helps!

    Avatar: Hanzla Nadeem
    Hanzla Nadeem
    Participant
    October 26, 2025 at 18:32

    not working

    Please contact administrator
    for this information.
    Files is visible for topic creator and
    support staff only.
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    October 26, 2025 at 19:35

    Hello @Hanzla Nadeem,

    If you would like to hide the notices on the Checkout page, please add the following custom CSS in your Theme Options -> Theme Custom CSS -> Global CSS:

    .woocommerce-checkout .woocommerce-notices-wrapper {
        display: none;
    }

    If you would like to apply the same change on the Cart page, please use the following custom CSS:

    .woocommerce-cart .woocommerce-notices-wrapper {
        display: none;
    }

    Best regards,
    Jack Richardson
    8Theme Team

    Avatar: Hanzla Nadeem
    Hanzla Nadeem
    Participant
    October 27, 2025 at 10:12

    this will hide all notices including error messages like Billing First Name is a required field. is there any better way to do where only add to cart notification hides?

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    October 27, 2025 at 13:18

    Hello @Hanzla Nadeem,

    Have you had a chance to test the solution we provided? The wrapper mentioned in our solution is not displayed for billing or shipping notices, but only for messages, as per your request.

    If you are experiencing any issues while testing the provided solution, could you please share a video demonstrating how the issue can be reproduced on your side?

    Additionally, you may try the following CSS and test it:

    .woocommerce-checkout .woocommerce-notices-wrapper:has(.button.wc-forward) {  
        display: none;  
    }

    Best regards,
    Jack Richardson
    8Theme Team

  • Viewing 6 results - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.