Woocommerce: Skip the product page and cart page to go straight to checkout

Online-ShoppingIf your are selling an ebook or tickets via woocommerce and you want your buyer to go straight to checkout instead of product page and cart when click on product link.
if you want your buyer click on link or button to buy product from any page or post add a product to the cart without even visiting the product page and skip the cart page.

Well this can be done by adding a link on the page or post and being redirected to the checkout directly with the product being added to the cart automatically.

Simply add a link on your page or post

For Example: <a href=”″>Buy Now</a>

Replace with your homepage URL and 37 by your product ID

Then add the following code to your functions.php file within your theme folder

/* woocommerce skip cart and redirect to checkout. */
function woocommerce_skip_cart() {
	$checkout_url = WC()->cart->get_checkout_url();
	return $checkout_url;
add_filter ('woocommerce_add_to_cart_redirect', 'woocommerce_skip_cart');


1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
The following two tabs change content below.

Wasim Sama

Wasim Sama is a passionate blogger and experienced web developer.

One thought on “Woocommerce: Skip the product page and cart page to go straight to checkout

Leave a Reply

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