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

Last Updated on

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=”http://your-site.com/?add-to-cart=37″>Buy Now</a>

Replace http://your-site.com 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)

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

  • March 13, 2017 at 5:00 am

    Thank you – this is just what I’ve been looking for! Works perfectly


Leave a Reply

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

More in WooCommerce
WooCommerce Product Page Content Position Change

To reorder the elements on woocommerce product page, Find content-single-product.php located within the WooCommerce plugin’s templates directory which holds the