Latest version
You can check the documentation you have the option to configure the cart page so that when we are supposed to access the cart, we will be accessing another page.
So, two things to let your visitor go to Checkout when they click "Buy":
Acedes a Woocommerce > Settings
Check the option to direct the visitor to the cart when using the "buy" button:
AcedesaWoocommerce>Settings>Checkout(Tab):
Where"Cart" is read, you choose "Checkout" for the "Cart page" so that the cart page is actually "Checkout":
Version2.1orhigher
Anothermethodforversionsfrom2.1istocreateafilterinthefilefunctions.php
:
add_filter ('add_to_cart_redirect', 'redirect_to_checkout');
function redirect_to_checkout() {
return WC()->cart->get_checkout_url();
}
Version less than 2.1
Versions below 2.1 you can create a filter in the file functions.php
, but the function is a little different:
add_filter ('add_to_cart_redirect', 'redirect_to_checkout');
function redirect_to_checkout() {
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url();
return $checkout_url;
}