You can directly go to the checkout page skipping the product page and the cart page by adding a link to a button and the following code on your functions file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
This is the structure of the link you must put on your button:
http://my-site.com?add-to-cart=idProduct
For example:
http://my-site.com?add-to-cart=28
*/
 
// Code tu add on your functions.php file
add_filter ('add_to_cart_redirect', 'redirect_to_checkout_page');
 
function edirect_to_checkout_page() {
 
	global $woocommerce;
 
	$checkout_url = $woocommerce->cart->get_checkout_url();
	return $checkout_url;
}
Woocommerce, direct to checkout page on one click
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *