easythemestore

How to Add a “Buy Now” Button in WooCommerce

How to Add a “Buy Now” Button in WooCommerce: A Step-by-Step Guide

If you’re running an online store using WooCommerce, you may want to add a “Buy Now” button alongside the standard “Add to Cart” option. This allows customers to skip the cart page and proceed directly to checkout, streamlining the purchasing process for impulse buyers or users who want a faster checkout experience.

In this comprehensive guide, we’ll cover multiple methods to add a “Buy Now” button in WooCommerce, including using plugins, custom code snippets, and WooCommerce settings.


Why Add a “Buy Now” Button in WooCommerce?

Before diving into the implementation, let’s understand why a “Buy Now” button can be beneficial:

  1. Faster Checkout Process – Customers can skip the cart and go straight to payment.
  2. Higher Conversion Rates – Reduces cart abandonment by minimizing steps.
  3. Better User Experience – Ideal for single-product purchases or digital downloads.
  4. Encourages Impulse Buying – Helps with upsells and quick purchases.

Now, let’s explore different ways to add this feature. Our YouTube channel; https://www.youtube.com/@easythemestore


Method 1: Using a WooCommerce Plugin

The easiest way to add a “Buy Now” button is by using a plugin. Here are some popular options:

1. Direct Checkout for WooCommerce

  • Allows you to replace the “Add to Cart” button with a “Buy Now” button.
  • Redirects users directly to checkout.

Steps:

  1. Install and activate the “Direct Checkout for WooCommerce” plugin.
  2. Go to WooCommerce → Settings → Direct Checkout.
  3. Enable “Skip Cart Page” and customize the button text.
  4. Save changes.

2. WooCommerce Quick Buy Now Button

  • Adds a secondary button next to “Add to Cart.”
  • Works with variable products.

Steps:

  1. Install the “WooCommerce Quick Buy Now Button” plugin.
  2. Configure settings under WooCommerce → Settings → Quick Buy Now.
  3. Set button text and redirect options.

Method 2: Custom Code Snippet (Without a Plugin)

If you prefer coding, you can add a “Buy Now” button using a PHP snippet.

Step 1: Add the Button via functions.php

Add this code to your child theme’s functions.php file or a custom plugin:

add_action('woocommerce_after_add_to_cart_button', 'add_buy_now_button');
function add_buy_now_button() {
    global $product;
    echo '<button type="submit" name="woocommerce_buy_now" class="button alt buy-now-button" value="' . $product->get_id() . '">Buy Now</button>';
}

Step 2: Handle the Redirect to Checkout

Add this code to process the button click:

add_action('wp_loaded', 'handle_buy_now_action');
function handle_buy_now_action() {
    if (isset($_REQUEST['woocommerce_buy_now']) && $_REQUEST['woocommerce_buy_now']) {
        WC()->cart->empty_cart();
        $product_id = absint($_REQUEST['woocommerce_buy_now']);
        WC()->cart->add_to_cart($product_id);
        wp_safe_redirect(wc_get_checkout_url());
        exit;
    }
}

Step 3: Style the Button (Optional)

Add CSS to make the button stand out:

.buy-now-button {
    background-color: #ff0000 !important;
    color: #fff !important;
    margin-left: 10px;
}

Method 3: Using WooCommerce Hooks & Filters

For developers comfortable with WooCommerce hooks, you can modify the cart behavior:

add_filter('woocommerce_add_to_cart_redirect', 'redirect_to_checkout');
function redirect_to_checkout($url) {
    if (isset($_REQUEST['buy_now']) && $_REQUEST['buy_now']) {
        $url = wc_get_checkout_url();
    }
    return $url;
}

Then, add a hidden field or modify the form to trigger this redirect.


Testing & Troubleshooting

After implementing any method:

  • Test the button on different product types (simple, variable).
  • Check mobile responsiveness.
  • Ensure payment gateways work correctly.

Conclusion

Adding a “Buy Now” button in WooCommerce improves user experience and boosts conversions. You can achieve this via:
✅ Plugins (easiest method)
✅ Custom PHP snippets (for developers)
✅ WooCommerce hooks (advanced control)

Choose the method that best fits your store’s needs and start offering a faster checkout experience today!

Would you like help with customizing the button further? Let me know in the comments! 🚀