Adding a “Buy Now” Button with WooCommerce
Adding a Buy Now button with WooCommerce is pretty easy, so I’ll keep it short. All you need to know for a direct Buy Now button is:
<?php echo do_shortcode('[add_to_cart_url id="25"]'); ?>
The above outputs the URL to add the item to the cart. I found that this didn’t work very well if you had “Enable AJAX add to cart buttons on archives” checked. In WooCommerce -> Settings -> Catalog, it’s under the “Add To Cart” section.
My full code looks like this:
<?php $add_to_cart = do_shortcode('[add_to_cart_url id="25"]'); ?> <a href="'. $add_to_cart .'"><img src="'. get_template_directory_uri() . '/img/small-cart.png" />Buy Now</a>
The button includes a cart icon to make it super sexy, or basic, however you see it. WooCommerce also has a large list of shortcodes to make developing e-comm themes easy. To see all of their shortcodes, click here.
So why bother with a “Buy Now” button. For me at least it’s nice and direct. So someone sees Buy Now and that’ the exact action that they’re able to take. They head directly to the checkout process to buy the thing they are trying to purchase.
By reducing steps in between, the hope is that conversion rates become higher. Without analytics it would be tough to know for sure, but that’s the hope.