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.

This article will teach you to add a buy now button in WooCommerce.

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.

Research shows that 1.7 to 4.1 is the average visited pages per session. By knowing that, your goal is to move your visitors to the checkout page through the least amount of pages possible.

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

Better user experience is also why we showed you how to set a default variation to make the customer’s decision easier.

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

Besides, 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.

Method #1: 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.

WooCommerce extensions

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

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.

Method #2: 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 total 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, check the replace box if you would like to remove the default add to cart button altogether.

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.

Related Article

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.

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