PressTigers

How to Add a Quick Buy Link in WooCommerce without a Plugin

WooCommerce being the most popular eCommerce plugin lets you create, manage and maintain an e-commerce store based on WordPress. Sometimes, you might need to insert a quick link to buy a product in WooCommerce custom template. Especially, in the case of subscription products.

In such cases, you can let your customers/users to bypass some extra steps of the checkout process such as:

  • Add to Cart
  • Go to Cart Page
  • Then go to Checkout page for Payment

With the help of a single click (quick buy link/button), you can redirect your customer directly to the cart/checkout page for payment. You just need to add the following code for redirecting customer to the cart page:

Use this code as:

<a href=”<?php echo home_url(‘/cart/?add-to-cart=’.$product_id);?>”>Buy Now</a>

Here, cart is the slug of WooCommerce Cart page and $product_id is the WooCommerce product ID.

Add the following code for redirecting customer to the checkout page:

Use this code as:

<a href=”<?php echo home_url(‘/checkout/?add-to-cart=’.$product_id);?>”>Buy Now</a>

Here, checkout is the slug of WooCommerce Checkout Page and $product_id is the WooCommerce product ID.

User Comments

2 thoughts on “How to Add a Quick Buy Link in WooCommerce without a Plugin

    Arshad Tharani says:

    Thank you for the shortcode. Where exactly should we place this shortcode?
    <a href=””>Buy Now

    I am to show it next to Add to Cart button.

      Hello Arshad,

      You have to put this code into your woo template. If you don’t know where this template, follow the below steps:

      1) Copy the templates from Woo commerce folder to your currently active theme (Parent or Child witch one you have activated)

      2) Search the “Buy Now” button from those templates (single product or product listing Page)

      3) Insert this code right in the next of that “Buy Now” button

      Thanks for reaching us out. Let us know if you need any other assistance from us.

      Regards,

      Abdullah | WP Plugin Developer
      Email: support@presstigers.com

Leave a Reply

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

Get in Touch