A “Buy Now” button can significantly improve conversions in WooCommerce by skipping the cart page and sending customers directly to checkout.
In this tutorial, you’ll learn how to add a custom Buy Now button using WooCommerce hooks.
Why a Buy Now Button Improves Sales
Reducing friction in the buying process is one of the most effective ways to increase conversions.
The fewer steps a customer has to take, the more likely they are to complete the purchase.
- Faster checkout process
- Fewer abandoned carts
- Better mobile experience
- Higher conversion rates
The WooCommerce Hook We Will Use
We will use:
woocommerce_after_add_to_cart_button
This hook allows us to add extra buttons right after the default Add to Cart button.
Example Code
Add this code to your 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;
if (!$product) {
return;
}
$checkout_url = wc_get_checkout_url();
echo '
Buy Now
';
}
How It Works
This function adds a new button next to the Add to Cart button.
When clicked, it:
- Adds the product directly to the cart
- Redirects the user to the checkout page
- Skips the cart page entirely
Optional Improvements
You can enhance this feature even more:
- Use AJAX to add product without page reload
- Show Buy Now only for specific products
- Add tracking events for analytics
- Style the button differently for mobile users
