BLACK FRIDAY SALE: Get 50% Off On Any UNLIMITED DOWNLOADS Plan! Use Code "blackfriday" At Checkout

DOWNLOAD ALL NOW!

Search for a plugin or theme

How to Add a Quick Buy Now Button to WooCommerce

You are currently viewing How to Add a Quick Buy Now Button to WooCommerce

Adding a buy now button to your products’ pages will speed up the checkout process on your website.

In many cases, the cart page adds an unnecessary extra step, and you should remove it.

In this article, you’ll learn how to add a WooCommerce buy now button.

Why Add Buy Now Button

As mentioned above, minimal steps in your checkout funnel will ultimately lead to more sales.

It makes sense. When you add an option for a quick buy, you reduce the number of pages that a customer needs to pass before a successful purchase.

The least amount of steps minimize the chance that something may go wrong during the process.

When adding a buy now button to WooCommerce, we initially helping the customer to skip the cart page and move directly to checkout.

Besides, all the big companies, such as eBay, and Amazon have the Buy now button next to the add-to-cart one for a quick transaction.

eBay Buy now button example

I will show you how to add a quick buy now button to WooCommerce products’ pages in the next section.

How to Add Buy Now Button in WooCommerce

There are two ways how to add buy now buttons to our WooCommerce store:

  • With a PHP function.
  • Using a plugin.

In this section, I will show you both ways, and let’s start with the first way, using a WordPress function.

Use a function

The PHP function will add a quick buy now button to the right of the add to cart button.

Once a customer clicks on the Buy now button, they’ll be automatically redirected to the checkout page to complete the purchase of the selected product.

You’ll need to paste the code below inside the functions.php file of your child theme.

First, navigate to Appearance -> Theme Editor and click on the functions.php file from the list on the right.

Functions file

Then, scroll to the bottom of the file, paste the code below, and save the changes.

// Add buy now button to WooCommerce
function add_content_after_addtocart() {

$current_product_id = get_the_ID();

$product = wc_get_product( $current_product_id );

$checkout_url = wc_get_checkout_url();

if( $product->is_type( 'simple' ) ){
echo '<a href="'.$checkout_url.'?add-to-cart='.$current_product_id.'" class="buy-now button">Buy Now</a>';
}
}
add_action( 'woocommerce_after_add_to_cart_button', 'add_content_after_addtocart' );
Paste the php function

Once saved, navigate to one of the products pages and click on the Buy Now button to verify that it’s working as expected.

Buy now button was added to single product

Please note that the code above will only work for a simple product and not for variable ones.

Adding a buy now button to products with multiple variations requires a complex code that defeats the purpose of using a function.

WooCommerce extensions

If you only have simple products in your store, you’re in luck and can defiantly use the code above. You can now move on and learn how to redirect customers after checkout.

However, if you’re also offering products with multiple variables, you better use a plugin.

Use a plugin

Using a plugin is preferred to add a buy now button because it’s the easiest and works with any product type.

In addition, the new button will inherit the used theme’s style sheet and will look great out of the box.

In this article, we will use the Quick Buy Now Button for the WooCommerce plugin by Addify.

You can download the plugin from the official website for a full price or from us for only $4.99 (same plugin).

Once downloaded, navigate to Plugins -> Add New -> Upload and upload the plugin.

Upload quick buy now button plugin to WordPress

Once activated, the new Buy now button will be added to the products page next to the add to cart button.

Add buy now button with a plugin

By default, the button’s text will be Quick Buy, and clicking on it will add the product and redirect you to the cart page.

If you’re ok with it, keep it as is. However, you can modify the button and change its text and behavior.

The button’s settings

To customize the button’s behavior, navigate to WooCommerce -> Quick Buy Button.

WooCommerce buy now button plugin

Under the general and the button’s settings tabs, you’ll have many options related to the button.

For example, if you would like to remove the default add to cart button altogether, check the replace box.

Replace add to cart button

To change the destination URL from the cart to the checkout page, expand the redirect location option and choose checkout.

In addition, you can also specify the categories where you would like to display the button.

To change the button’s text, navigate to the button settings tab and enter the Buy now text inside the label to change the quick buy text.

Replace button text to buy now

Additional options on this screen are hiding the shop page button or changing the buttons’ position.

Once you are done with the settings, save the changes and test the button.

Conclusion

In this article, you learned how to add a buy now button to WooCommerce products pages in multiple ways.

Leave us a comment and let us know which way you choose to achieve this task.

Also, make sure to subscribe to our YouTube channel and like our page on Facebook.

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on email

PluginsForWP

PluginsForWP is a website specializing in redistributing WordPress plugins and themes with a variety of knowledge about WordPress, internet marketing, and blogging.

Leave a Reply