Cartfunnel Cart API


The cart API is the easiest way to integrate with Cartfunnel from any website, such as WordPress. Following a simple URL structure, you can pass a single or multiple products into Cartfunnel’s built-in shopping cart by constructing a URL and redirecting the customer to that specific URL.

Example use cases:

  • Building a simple shopping cart
  • Providing direct to check out links

If you need to modify the customer’s shopping cart (eg. using a drawer cart), you will want to take a look at our Cart AJAX/JSON API.

The URL structure

For the following examples, we will assume that your Cartfunnel account lives at https://myshop.cartfunnel.net. If you’re using custom domains, you can replace the https://myshop.cartfunnel.net with your the domain you’ve set up with us.

To create a link where an item can be added to the cart, you must follow this URL structure:

https://myshop.cartfunnel.net/cart/{{ variant_id}}:{{ quantity }}

For example, say you have a product with the following variants:

  • T-Shirt Size Small (variant ID of 100)
  • T-Shirt Size Medium (variant ID of 200)
  • T-Shirt Size Large (variant ID of 300)

To add a T-Shirt Size Medium with a quantity of 1, you would use the following URL:


Similarly, if you wanted a quantity of 2, this would be the URL to use:


By using this simple URL structure, you can develop quite sophisticated add to cart features on your own website.

Finding the variant ID

Each product has its own number of variants. Refer to our guide regarding products.

Each product has at least one variant (eg. the “default” variant). Products with multiple variants have a variant ID assigned to each individual variant. To find the product variant ID (eg. for the various sizes), you can use the product link generator:

Where is this link generator? You can find it by navigating to the specific product in the Cartfunnel dashboard, going to Products, and clicking on the specific product. The link generator will be on the right hand side of the page (when viewed on a desktop sized screen).

The Product Link Generator automatically creates the link structure for you, including the variant ID already in the link for that particular variant. In the screenshot above, it is creating a link for the Small / White size variant of a clothing item.

If you click on Copy, the link that’s copied to your computer’s clipboard is the following:


Here, you see that the variant ID is assigned as 23923, and that this link will add a quantity of 1 to the shopping cart.

Setting the quantity

As we’ve discussed above, to set the quantity you must pass in the numerical value as the second parameter following the variant ID.

For example:


If your customer goes to this URL repeatedly, you will see that the quantity added remains at 1. This URL will only set the total quantity for that variant ID. For this reason, we recommend that you avoid using a quantity selector on your product page and let customers adjust the quantity when they are on the Cartfunnel-hosted cart page instead.

Adding subscriptions

To add subscriptions, the URL structure changes slightly. You will need to append a third parameter to the URL above.

First, you will need the subscription settings ID. This is the subscription setting for that particular product. Please refer to our guide on recurring billing/subscriptions for products.

Again, the Product Link Generator can help generate the appropriate link for you:

Select the subscription you want, and Copy the link from the appropriate variant. The URL should come out like this:


What you see here is a third parameter that’s appended to the end of the URL. Here, we see the number 883, indicating the subscription setting ID of 883. This is unique to each product, and the subscription setting ID must match the product to which the above variant (in this case, variant ID of 23923).

Once you add this to the cart, the recurring billing/subscription settings for that will be added on for the line item.

Adding multiple products/variants at the same time

You may wish to add multiple line items in a single request. In this case, you can chain together the parameters like the following.

Using the following variants and subscription settings ID as an example:

  • T-Shirt Size Small (variant ID of 100)
  • T-Shirt Size Medium (variant ID of 200)
  • T-Shirt Size Large (variant ID of 300)
  • Monthly subscription (subscription settings ID of 99)

The following URL will add 2x Small, 3x Medium single purchase, 1x Medium monthly subscription, and 1x Large:


Let’s break the parameters of this URL down:

  • 100:2 represents T-Shirt Size Small and quantity of 2
  • 200:3 represents T-Shirt Size Medium and quantity of 3
  • 200:3:99 represents a recurring subscription for T-Shirt Size Medium and quantity of 1
  • 300:1 represents T-Shirt Size Large and a quantity of 1

This website uses cookies to ensure you get the best experience on our website.

Split payments into cycles

Accept deposit payments

Configure your products to receive a set deposit. The customer’s billing information is retained so you can bill them again later.

Pre and Post payment upsells
Set upsell conditions

One click upsells

Show the right upsell offer during the checkout flow. Offer upsells both before and after payment has been made.

Recurring billing in Shopify
Charge later

Recurring billing done right.

We will build a recurring billing solution for your business that can adapt and change to whatever your business needs.

HTML Liquid templates
Liquid code

Customizable checkout pages

Easily make changes to your checkout pages to maximize for conversion. Change your font, colors, agree to terms, and more.