isotropic-2022
Share
Blog
Search
Menu

How To Create A Direct Checkout Link For WooCommerce

By James LePage
 on March 7, 2022

How To Create A Direct Checkout Link For WooCommerce

By James LePage
 on March 7, 2022

This article will walk you through how to create a direct checkout link for a WooCommerce product. These type of links will automatically add products to your cart, making it easy to share specific configurations directly with customers. By clicking the link they will skip through the sales process and end up directly at the checkout.

By default, direct checkout links with WooCommerce are incredibly powerful and versatile. You can sell different variations, quantities, collections of products, coupons, and more, directly within the URL structure. This article will serve as a reference to all of the features offered by this tool. You can use these types of links directly on your website, share them with customers, or post them on social media (such as Instagram Story "swipe ups").

Use Cases For Direct Checkout Links

(skip to direct checkout link how to)

There are many uses for direct checkout links in WooCommerce. Here are a few examples:

Sending A Link To Customers

Sometimes it's clear that a customer is ready to check out, but for some reason or another they require support or assistance. Instead of directing them to go through the standard funnel of your homepage, to the product page, to the cart page, to the checkout page, you can send them directly to checkout with a preconfigured cart by using a direct checkout link. Therefore, you ensure that they won't drop off or not convert, making the process as seamless and quick as possible.

This is especially helpful when offering support. For example, what if the customer support questions about the product and has sent a message showing that they are ready to purchase? Instead of responding with the link to the product page, simply link them directly to the checkout!

Bulk/Wholesale Orders

Please note, this shouldn't replace the need for a wholesale area within the website if your business depends on this model. However, for the one off bulk orders that businesses sometimes go, this is a great option.

Say somebody wants to purchase 50 units in one go. You can simply send them a link to purchase this immediately. This is a great option if public products are limited to a maximum quantity.

Another interesting concept is sending a bulk checkout link with a 100% discount coupon attached (we will go over how to do that in a later section). In many situations, large orders are best paid via bank transfer. Therefore, you can handle payment via invoice (Stripe Invoice is great, as is 's Invoice feature) giving your purchaser terms like 2/10 Net 30 (which would be impossible to do in core WooCommerce without a plugin), but still manage the order through your Woo dashboard, and automatically sync to a shipping provider if set up.

Sharing A Direct Checkout on Social Media

Social media is a great way to convert visitors into customers and build communities around your products. If you have a large enough Instagram, adding swipe up links within your stories is a great way to convert customers.

For example, you can create a story detailing a specific product, and direct your customers to swipe up to buy it. The link will load your website's checkout page, populate the product, and make it incredibly easy for a user to purchase.

Linking To Checkouts Within Content

If your e-commerce website focus heavily on content marketing (and it should!), you can link directly to checkout with in contact. For example, say you are writing about a flower vase and why your product is the best. Within the content, you can create and add to cart link the functions similarly to the button on the product page. However, it removes an extra step, which will increase conversions. For example, within Gutenberg I can add a button with a checkout link like so:

It will link directly to the checkout adding whatever product is specified.

WooCommerce.com uses this concept on their 3rd party plugin documentation. Check out the URL of the "buy now" button:

image-11-10

Creating Add To Cart Buttons

for some projects, our agency has created a JavaScript solution that utilizes this direct to check out link feature in one commerce to dynamically create specific links. For example, we have a landing page with a group product. This grouped product actually consists of three individual products (a single purchase, a subscription purchase, and a three month subscription purchase).

When the user selects one of the three options, a JavaScript snippet notices this and updates a direct checkout link within a button. We use the concepts outlined below to create massively custom and dynamic check out processes. Of course, you can do this using PHP or other methods within WooCommerce, but this is a quick and easy way to create a custom flow and is incredibly helpful when testing out specific ideas or concepts.

How To Make Direct Checkout Links In WooCommerce

This section will show you how to make direct to check out links. There are many different variations that you will be able to experiment with, and this section will contain detailed instructions for each. This continent is current for the year of 2024 and WooCommerce V6.0+.

WooCommerce Product

To create a direct to check out link for a simple WooCommerce product, all you need is the ID of that specific product. With it, you'll generate the standard add to cart link that comes with WC core.

You can find it by hovering over the product in the product list, or by editing the individual products, and looking and it's URL structure.

image-8-10
Hover over product to show the ID
image-9-11
Find the ID in the url when editing the product. post=ID

The link that will add the product directly to the cart is as follows:

https://yoursite.com/?add-to-cart={productID}

If you want to skip over all pages and bring them directly to the checkout, the link would be:

https://yoursite.com/checkout/?add-to-cart={productID}

As you can see, you can link to any page on your website, and add the following parameter, which will add the product to the cart:

/?add-to-cart={productID}

Variable Products

Variable products follow the same URL structure, except the ID should match the individual variation, not the overall product. To find the variation ID, follow these steps.

  1. Go to the product page in WooCommerce.
  2. Go to the variation tab in woocommerce.
  3. Identify the ID.
  4. Make the link following the steps above.
image-10-10
The variation ID is 123 in this example.

Grouped Products

Grouped products are essentially folders of individual standard products. Therefore, to add a standard product to the cart, follow the methods above. With the group product, you can link directly to its landing page, while adding an individual product to the cart. This is the most common use case when it comes to this type of direct link.

However, Group products also have their own ID, and you can also use that depending on the result you are looking to achieve.

Subscription Products

Creating a direct check out links for subscription products in WooCommerce created with the official plugin is very simple. Find the product as you normally would, and create use the same link structure as a standard product.

It will follow the default renewal schedule.

Read: Best WooCommerce Subscription Plugins For 2022

Product Quantity

By default, your direct checkout link will add a single product to the cart. If a customer decides to reload the page, it will add an additional product to the cart. However, say you want to have a customer add multiple products at once. Then, revise the link accordingly:

/?add-to-cart={productID}&quantity={number} /* Example - add 5 products and go to checkout page */ https://mysite.com/checkout/?add-to-cart=99&quantity=5

As you can see, making an add to cart link with quantity is really simple!

Product Quantity with Grouped Products

With grouped products, there are multiple products associated under one group. Therefore, the quantity structure within the URL changes when using this type.

/?add-to-cart={groupID}&quantity[{productID}]={number} https://mysite.com/checkout/?add-to-cart=99&quantity[100]=5&quantity[101]=6

For the quantity, you need to specify the individual product ID within the group, and then the number of units added for that specific one. In the example link above, we are adding the grouped product with an ID of 99 to the card. The two single products within the group product are adding 5 units of product 100 and 6 units of product 101.

Add Coupon

We've had a few questions asking how to add a coupon to a WooCommerce session via a URL.

For this situation, you can use a plugin or a code snippet. It is not built into the core direct link feature within WooCommerce.

Add the following code snippet to your functions.php file or use a snippet management tool:

function iso_woocommerce_coupon_links(){ if (!function_exists('WC') || !WC()->session) { return; } $query_var = apply_filters('woocommerce_coupon_links_query_var', 'coupon_code'); if (empty($_GET[$query_var])) { return; } WC()->session->set_customer_session_cookie(true); if (!WC()->cart->has_discount($_GET[$query_var])) { WC()->cart->add_discount($_GET[$query_var]); } } add_action('wp_loaded', 'iso_woocommerce_coupon_links', 30); add_action('woocommerce_add_to_cart', 'iso_woocommerce_coupon_links');

This snippet is modified from "Automatically Apply A Coupon Passed Via URL To The Cart In WooCommerce" by WebRoom. Check out that article for a full explanation on how this code works.

To use it, generate the following URL:

/?add-to-cart={productID}&coupon_code={code}

This can be used as a standalone parameter, or in conjunction with anything else mentioned in this article. It's great for Social Bio Links and Instagram Story "swipe ups!".

The SkyVerge WooCommerce Coupon URLs offers a few more features and a visual way to generate these links. If you are building a client website, this may be a better option for you, but the snippet above works perfectly if you simply want to add a coupon via a direct link to your WooCommerce website.

Will A Plugin Do This For Me?

Yes, there are a couple plugins out there that will do this for you. However, they are unnecessarily complicated and if you are a shop owner or a developer, it's good to memorize how to manually create these links, which is outlined above.

Here are a few of those popular WordPress plugins:

As an alternative, we have built a utility that allows you to create direct check out links in a visual way. Therefore, you don't need to commit anything to memory, nor do you need to download a complex plug-in. Simply initialize the tool, enter the information, and generate the link.

Conclusion

We hope that this article helped you create a direct add to cart link for WooCommerce. This is an important concept to understand if you are a developer or shop owner as it can drastically increase conversions when used properly. It's a very powerful way of getting a customer to add products to the cart, and you can even set the quantity, and or variations!

codewp-ai-og-new
Meet CodeWP, an AI Code Generator
Prompt CodeWP in plain English and it'll output high quality code, specific for WordPress.
isogroup-cover
Join The IsoGroup
A vibrant Facebook Group to talk about web design and the business of agency. Daily curated resources and conversations.
Join Now
bricks-builder-course
Bricks Builder Course - Coming Soon
The Bricks Builder Mastery course will bring you up to speed on this popular builder.
Get Launch Notification & Discount
Subscribe & Share
If you liked this content, subscribe for our monthly roundup of WordPress news, website inspiration, exclusive deals and interesting articles.
Unsubscribe at any time. We do not spam and will never sell or share your email.
Subscribe
Notify of
guest
12 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
CStutes
CStutes
1 year ago

Hi James! Thanks for this great info. I'm wondering, can I manually create a direct checkout link that includes two different products to add to the cart?

asher
asher
1 year ago

Hi, Where to update those links for direct check of product?

Raghav
Raghav
1 year ago

Hi, when I create such link, I am only directed to the cart page and it says, your cart is empty. I am talking about this link.

https://yoursite.com/checkout/?add-to-cart={product id}

Narcisa
Narcisa
1 year ago

Hi, when i create a link with grouped products it sends me on add to cart page, but when i make a checkout link for a simple product, it sends me on checkout page.
How to make the link for the grouped products to send me on a checkout page?

i made my example:
for grouped products
/?add-to-cart=12134&quantity[11897]=1&quantity[11984]=1

and for the simple product
?add-to-cart=11897

Thanks,

David
David
1 year ago

Thank you good Sir.!

Ana Alexandra
Ana Alexandra
1 year ago

Hi James,
Thanks for this info, I've tried and it works seamlessly but the preview of the link comes with specific information like adress and an inexistent costumer name.

Do you've experienced something like that?

brianhenryie
brianhenryie
1 year ago

And to set the gateway: https://wordpress.org/plugins/bh-wc-set-gateway-by-url/
And to log the user in (prefill checkout): https://wordpress.org/plugins/bh-wp-autologin-urls/

Both on GitHub too.

Erik
Erik
7 months ago

Hi James,

Does redirecting to checkout still work this way?

> https://yoursite.com/checkout/?add-to-cart={productID}

...keeps sending me to the cart-page..

brenda Liona
brenda Liona
7 months ago
Reply to  Erik

getting the same error too

Sabbir
Sabbir
7 months ago

I use "quantity=1" but it allows adding 2 products to the cart, how can I solve this?

Article By
James LePage
Contributors/Editors
notloggedin
James LePage is the founder of Isotropic, a WordPress education company and digital agency. He is also the founder of CodeWP.ai, a venture backed startup bringing AI to WordPress creators.
We're looking for new authors. Explore Isotropic Jobs.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram