Removing Continue Shopping button from Added to Cart Notice

how to add continue shopping button in woocommerce cart page
add to cart message
woocommerce remove added to cart message
add checkout button on cart page woocommerce
wc_add_to_cart_message_html
woocommerce return to shop
remove return to shop button woocommerce

Currently when someone adds a product to our website it says: "X Product" has been added to your cart | and then has a "Continue Shopping" button in that notice that is on the right.

Since we only sell 2 products we want to remove the continue shopping button completely but still say the rest of the message, and keep "X Product" as a link.

I've been using the following code (but it replaces Continue Shopping with Checkout and I'd prefer to just remove the button completely instead). I just can't figure out how to remove the button but still keep the rest of the message exactly the same:

add_filter( 'woocommerce_continue_shopping_redirect', 'my_changed_woocommerce_continue_shopping_redirect', 10, 1 );
function my_changed_woocommerce_continue_shopping_redirect( $return_to ){

    $return_to = wc_get_page_permalink( 'checkout' );

    return $return_to;
}


add_filter( 'wc_add_to_cart_message_html', 'my_changed_wc_add_to_cart_message_html', 10, 2 );
function my_changed_wc_add_to_cart_message_html($message, $products){

    if (strpos($message, 'Continue shopping') !== false) {
        $message = str_replace("Continue shopping", "Checkout", $message);
    }

    return $message;

}

Use preg_replace to find the string containing the full link and return the new message with all the original HTML minus the link.

add_filter('wc_add_to_cart_message_html','remove_continue_shoppping_button',10,2);

function remove_continue_shoppping_button($message, $products) {
    if (strpos($message, 'Continue shopping') !== false) {
        return preg_replace('/<a.*<\/a>/m','', $message);
    } else {
        return $message;
    }
}

Removes "Continue Shopping" message from WooCommerce after , Removes "Continue Shopping" message from WooCommerce after item has been added to cart. remove-woocommerce-message-part.php. <?php. \add_filter​( 'wc_add_to_cart_message', function( $string, $product_id = 0 ) {. $start = strpos(​  A client asked me to completely remove the message that appears after you add a product to the cart from the product page. This is simply done by using a PHP snippet, so here’s the quick fix for you! PHP Snippet #1: REMOVE “X has been added to your cart” Message PHP Snippet #2: EDIT […]

/* Start Disable Continue Shopping Message after Add to Cart
*/

add_filter( 'wc_add_to_cart_message', function( $string, $product_id = 0 ) {
    $start = strpos( $string, '<a href=' ) ?: 0;
    $end = strpos( $string, '</a>', $start ) ?: 0;
    return substr( $string, $end ) ?: $string;
});

/* End Disable Continue Shopping Message after Add to Cart
*/

Topic Tag: continue shopping, [WooCommerce] Remove 'Continue shopping' button from added to cart message. Started by: CriterioNet. 4; 6; 4 years ago · whois · [WooCommerce] Custom  Removes "Continue Shopping" message from WooCommerce after item has been added to cart. - remove-woocommerce-message-part.php

If anyone is interested the following code fixed it perfectly, just replace id-407 with whatever page id your Cart page is:

    /* Remove Continue Shopping Button Add Cart */
body.page-id-407 .woocommerce-message .button {
    display: none
}

WooCommerce: Remove / Edit "Added to Your Cart" Message, PHP Snippet #1: REMOVE “X has been added to your cart” Message WooCommerce: Add Plus & Minus Buttons To Add to Cart Quantity Input I was trying to add both view cart and continue shopping in the same area. <button type="button" onclick="history.back();">Back</button> Note: onclick="history.back();" You can put this code in button or link of your Continue shopping button. For cart icon highlight i think in Minimal theme its item count next to cart icon in header, if you have custom code then send me your store url so i can check.

WooCommerce: Edit "Continue Shopping" Link Redirect, "Continue Shopping" appears on the Cart page when an item is and you have “​Redirect to the cart page after successful addition” enabled via the WooCommerce settings. By default, “Continue Shopping” button redirects to the previously WooCommerce: Remove Product From Cart Programmatically  Thanks Bobby-Joe, but this isn't what I need. As mentioned, I already know the filter to change the 'Add to cart' button and also the message shown when an item is added to the cart. It's the message text shown when a user changes the quantity of a product within the cart, and selects 'Update Cart'. – scribbles Nov 25 '13 at 18:14

How to Change Woocommerce Continue Shopping Button Text , woocommerce continue shopping button on checkout page,remove popup,add back to Duration: 3:12 Posted: Aug 2, 2019 By default WooCommerce Cart page does not have a ‘Continue Shopping’ or ‘Return to Store’ button. In this tutorial we’ll learn how to add a continue shopping button to the cart page.

Add a Continue Shopping Button to WooCommerce Checkout , Add a 'Continue Shopping' Button to Woo Commerce Checkout and Cart Page By default WooCommerce Cart page does not have a 'Continue The apply_filters is removed as the filter will already be applied from the original code​. Hide Amount of Items from Add to Cart Message in WooCommerce. Adding a continue shopping button to cart page enhance user experience and is a great addition to UX perspective. In this tutorial we’ll learn how to add a continue shopping button to the cart page. First of all let’s have a look at what our default cart page looks like. To do this add products to cart and continue to cart page.

Comments
  • This doesn't remove anything. It just hides it - an absolutely horrible practice.
  • This is O.K. for a strictly visual approach as it does hide it from a CSS perspective but the better way is to remove the rendering of the object in the main function loop using an 'add_filter' call which would make for a more performant approach.