The Cart Page of a WooCommerce store helps customers to review their order before proceeding to the Checkout page to make the payment for the same. It is on the Cart page where the customer can delete an item from their virtual basket or increase the quantity of added items. Once the order is finalised, the customer then clicks on the Proceed to checkout button to go to the Checkout page.
In many cases though, you may want the customer to skip the Checkout page and instead directly go to the Payment Gateway page and make the payment. As a real world example, for stores which accept payments mostly through PayPal, an exclusive button for it is added using plugins such as Express Checkout, in which case the customer can directly go to the PayPal page by clicking on the PayPal Check out button that appears below the Proceed to checkout button.
In case of when the store accepts payments only through PayPal and no other payment method, the “Proceed to checkout” button becomes an overhead for the customer. For these instances, let’s see how we can remove the Proceed to checkout button on the WooCommerce cart page.
Removing the Proceed to checkout button from the Cart page
The following line of code, when added to the functions.php file of your child theme, will result in this button getting removed from the page:
function ts_remove_proceed_to_checkout_button() { if (is_cart()) { remove_action('woocommerce_cart_collaterals', 'woocommerce_cart_totals', 10); } } add_action('template_redirect', 'ts_remove_proceed_to_checkout_button');
The woocommerce_button_proceed_to_checkout is a function that outputs the Checkout button. By removing this using the woocommerce_proceed_to_checkout hook, the button won’t be rendered.
In this way, your customers can directly go to the payment gateway page to make the payment:
Hi Anubha Bhat, Thanks for your clear explanation. I want to change the text of my ‘Proceed to checkout button’ but the text won’t change for the button. I am using Elementor PRO With the business subscription of wordpress. Is there maybe any code I can insert for a new ‘proceed to checkout button’ with custom text that I can use? This would absolutely mean the world to me, I have been looking over the whole internet and this post is the one that comes near my problem most. Looking forward to your reply so much. Kind regards, Thomas van… Read more »
Hello,
Thanks for your comment. Sure, you can add a custom checkout button after removing the existing button. After you add the code mentioned in this article to remove the default Checkout button, please add the code below to add the custom one:
function add_custom_checkout_button() {
echo ‘<a href=”‘ . esc_url( wc_get_checkout_url() ) . ‘” class=”button alt wc-custom-checkout-button”>’ . esc_html__( ‘Custom Checkout’, ‘storefront’ ) . ‘</a>’;
}
add_action( ‘woocommerce_after_cart_table’, ‘add_custom_checkout_button’ );
You may replace ‘Custom Checkout’ with the text of your preference, and ‘storefront’ refers to the slug of my theme.
Hi Anhuba,
Thanks for your quick reply.
I added the lines of code to code snippets but the custom text did not appear in the designated button for ‘Proceed to checkout’. I think it is almost working but I cannot find out why it does not appear in the designated box. The button is also not deleted which is very strange.
Could you maybe look what I could do to help it and solve it?
This would mean the world to me.
Thomas
Hello Thomas, This looks like the original Checkout button. Have you added the code to remove this button? Please find the entire code below that you need to paste in the functions.php file. The first snippet is for removing the default button, and the second one is for displaying the new one : /* Remove existing Checkout button */ function ts_remove_proceed_to_checkout_button() { if (is_cart()) { remove_action(‘woocommerce_cart_collaterals’, ‘woocommerce_cart_totals’, 10); } } add_action(‘template_redirect’, ‘ts_remove_proceed_to_checkout_button’); /* Add custom checkout button on cart page */ function add_custom_checkout_button() { echo ‘<a href=”‘ . esc_url( wc_get_checkout_url() ) . ‘” class=”button alt wc-custom-checkout-button”>’ . esc_html__(… Read more »
This worked. Thanks!
You’re welcome, I have now updated the code though.
Great post. Thank you!
You’re welcome! I have updated the code for 2023.
Hello, can we do the same for the order button ?
May I know which Order button you are referring to exactly?
Hi, thanks for your post. I think it can help me a lot. But There are so manly lines of code in functions.php file of my child theme, could you please tell me where exactly to add this line of code?
You’re welcome, I have updated the code for 2023 now. You can add it to the bottom of your functions.php file.