Select Page

Skip the cart and go straight to checkout!

In this post, I’ll show you an easy way to create a short link that you can use in a button to skip the cart page and go straight to the checkout page.

OK, let’s jump in.

Yes, you can have a simple “BUY NOW” button for a product in WooCommerce that takes the customer directly to the checkout page.

It will most likely increase your conversion rate because it removes a step (“the cart page”) from the purchasing process. Your customers will leap to the checkout page, ready to pay!

woocommerce straight to checkout run

This feature is especially relevant if you have a single product like an ebook or an online course.

It even works well with subscription or membership based sites where you can have up to 3 plans or products which can only be purchased once.

We can easily implement this functionality by following 3 easy steps.

#1 Add PHP snippet to your site

Below is a little bit of code that we need to add to our site to enable us to add a link that goes straight to the checkout page.


function straight_to_checkout() {
 $checkouturl = WC()->cart->get_checkout_url();
 return $checkouturl;

You can add this piece of code at the bottom of your theme’s functions.php file. If you know how to do this you can skip to step #2.

If you are new to this kind of thing and don’t have an idea how you should add this piece of code, I’ll show you an easy way to get it done.

Install and Activate a new plugin called “Code Snippets”

Go to the Snippets tab in the menu and add a new snippet.

Name the snippet and copy the code above into the textbox. Then click the “Save Changes and Activate” button.

#2 Get your product ID

Go to your products in WooCommerce and hover over the product that you would like to use to reveal the product ID and note it down. In this case, the product ID is 46702. Now we are ready to compile our link.

#3 Compile your link and add it to your button

To compile your link you’ll need your website domain and the product ID. In this case, we’ll use http://mystore.com as the domain and 46702 as product id.

The link would then look as follows:


You can now use this link in any button on your site to go straight to the checkout page.

And you’re DONE!

When you click the button it will now redirect straight to the checkout page with the product added in the list.


Subscribe to our blog

* indicates required

Pin It on Pinterest