Contents
This button function is to redirect the cart page to the checkout page after you have verified that the contents of the cart are OK. You probably want to change this Proceed to Checkout text to custom text like ‘ Go to Secure Checkout’.
How to remove 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: 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.
This will add a button after the normal Add to cart button on single product pages. As you can see I also added a check to see if the current product is a simple product or not. If you want to use this with variation, it is more difficult.
How to check and redirect to login before?
In the second answer there is a problem, after loging in the user always redirects checkout page, it does not stand on my-account page until the cart become empty!! This code redirects the user to my-account page for login instead of checkout if the user is not logged in, then after loging in it automatically redirects to checkout page.
The Proceed to Checkout text is located in the WooCommerce cart page and appears after the totals as shown on this image: This button function is to redirect the cart page to the checkout page after you have verified that the contents of the cart are OK.
How to force redirect to checkout on add to cart?
Here’s how you force redirection to the checkout page every time a product is added to cart, no matter if you do so from the loop/shop pages or the single product page. On top of adding the code to your functions.php you also need to double check your WooCommerce settings, see screenshot below.
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.