Guides

How to add the "Buy Now" button in WooCommerce

In the digital era, where online shopping is becoming increasingly popular, proper web store design is key to success. One of the essential elements of any e-commerce store is buttons that guide the customer through the purchasing process. In this article, we'll examine two main buttons: "Buy Now" and "Add to Cart," their pros, cons, and how they can impact your conversion rates.

"Buy Now" Button

The "Buy Now" button allows customers to make an immediate purchase with a single click, bypassing the traditional shopping cart.

Pros:

  • Reduces resistance in the purchasing process: Customers can make a quick and easy purchase without navigating through multiple pages or adding products to the cart.
  • Increases the sense of purchase urgency: When customers see the "Buy Now" button, they know the product is available for immediate purchase, encouraging quicker decisions.
  • Higher conversion rates for impulse purchases: The "Buy Now" button is ideal for customers making impulse purchases.

Cons:

  • No opportunity for upselling or cross-selling: Customers only see the product they are buying, without the chance to explore other related offers.
  • Potentially more abandoned carts: If a customer decides to purchase additional products after clicking "Buy Now," they have to restart the purchasing process.

"Add to Cart" Button

The "Add to Cart" button allows customers to add a product to a virtual cart, continuing shopping or completing the transaction later.

Pros:

  1. Opportunity for upselling and cross-selling: When a customer adds a product to the cart, they can see related products, potentially leading to additional purchases.
  2. Reduces the number of abandoned carts: Customers can save products for later, reducing the risk of forgetting about them.

Cons:

  1. Increases resistance in the purchasing process: Customers have to go through several steps before making a purchase, which can be frustrating.
  2. Reduces the sense of purchase urgency: Customers may postpone the purchase, leading to delays or abandoning the transaction.

How to Choose the Right Button for Your Online Store

The choice between the "Buy Now" and "Add to Cart" buttons depends on factors such as the shopping behavior of your target audience, the types of products offered, and the desired customer experience. Consider which button better meets your customers' expectations and delivers better results for your business. Whether you choose one button or decide to use both on product pages, remember to optimize the buttons and tailor them to your customers' needs to provide the best shopping experience.

"Buy Now" Button Code for WooCommerce

/***************************** Buy now button  *****************************/

function renowners_add_prod_buy_now() {
    global $product;
    if (!$product) {
        return;
    }
   
    $checkout_url = wc_get_checkout_url();
   
    if( $product->is_type( 'simple' ) ){
    echo '<a href="'.$checkout_url.'?add-to-cart='.$product->get_id().'" class="buy-now button">Kup teraz</a>';
    ?>
    <script>
        $j = jQuery.noConflict();
        $j('a.buy-now').on('click', function(e) {
            e.preventDefault();
            let url = $j(this).attr('href');
            let qty = $j('input.qty').val();
            let redirect = url+'&quantity='+qty;
            window.location.replace(redirect);
        })
    </script>
    <?php
    } else {
        echo '<a data-url="'.$checkout_url.'" class="buy-now button disabled">Kup teraz</a>';
        ?>
        <script>
            $j = jQuery.noConflict();
            $j(document).change(function() {
                if ($j('input.variation_id').val()) {
                    
                    let points = $j('span.wc-points-rewards-product-message').html();
                    $j('p.points').html(points);
                    
                    if ($j('a.buy-now').hasClass('disabled')) {
                        $j('a.buy-now').removeClass('disabled');
                    }
                } else {
                    if (!$j('a.buy-now').hasClass('disabled')) {
                        $j('a.buy-now').addClass('disabled');
                    }
                }
            })

            $j('a.buy-now').on('click', function(e) {
                e.preventDefault();
                var checkout_url = $j(this).data('url');
                $j.ajax({
							url: $j('form.cart').attr('action'),
							type: 'post',
							dataType: 'json',
							data: $j('form.cart').serialize(),
						}) .always(function() {
                            window.location.replace(checkout_url);
                            });

                });
        </script>
        <?php
    } 
        
}

add_action( 'woocommerce_after_add_to_cart_button', 'renowners_add_prod_buy_now', 20);
JavaScript
Full care for WordPress.
Turn off your worries, turn on the security and care for your WordPress
View plans

Leave a Reply

Your email address will not be published. Required fields are marked *