Woocommerce Checkout Page: Delete View Cart Button and Other Messages

First off, I'm a little noob. I am not a web developer / programmer. But I'm not an idiot either, and played with functions.php (a bit).

here is the page:

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

When users click on the link on my landing page, it automatically adds the product to the cart and transfers them to the verification page.

Now I would like to do the following.

  • Remove / hide the "View Trash" button. This is the most important ... I do not want people to leave this verification page.

  • I would not mind deleting all messages: a. successfully added to cart. b. customer return and c. have a coupon, but not very important.

+4
source share
3 answers

For the message "Add to Cart":

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 customers, just turn them off on the woocommerce options page

EDIT: fix for latest version (2.4.6)

0
source

There are two ways in the latest version of woocommerce:

You can hide css or inside woocommerce / include / wc-template functions

function remove_loop_button(){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
add_action('init','remove_loop_button');

On the product page and on one page, both buttons will be deleted immediately.

Thanks Tripathi

0
source

" " - "display: none" style.css

:

.added_to_cart .wc-forward{
    display: none !important;
}

a.added_to_cart{
    display: none !important;
}
0
source

Source: https://habr.com/ru/post/1535470/


All Articles