Woocommerce checkout page: remove view cart button & other messages

user3509345 picture user3509345 · Apr 8, 2014 · Viewed 8k times · Source

First, I'm a bit of a noob. I'm not a web developer/programmer. But I'm also not an idiot and have played with functions.php (just a little bit).

here is the page:

https://tefl-online-course.com/checkout-lp/?add-to-cart=228

When users click on a link on my Landing Page it adds the product to the cart automatically and takes them to the checkout page.

Now, I would like to do the following.

  1. Remove/hide the "View Cart" button. This is the most important...I don't want people leaving this checkout page.

  2. I wouldn't mind removing all of the messages: a. successfully added to cart. b. returning customer & c. have a coupon but not hugely important.

Answer

XciD picture XciD · Nov 23, 2014

For the add to cart message :

add_action( 'woocommerce_init', 'remove_message_after_add_to_cart', 99);

function remove_message_after_add_to_cart(){
    if( isset( $_GET['add-to-cart'] ) ){
        wc_clear_notices();
    }
}

For coupon and return customer , just disabled them on woocommerce options page

EDIT : Fix for lastest version (2.4.6)