How to give away free courses with ThriveCart Learn

ThriveCart is a pay-once-use-it-forever cart system that's ideal for selling digital products like ebooks & courses.

They even have a bolt-on called Learn – a course hosting platform. It's a little clunky, but you can't argue with the price over the long term.

One drawback of it is that if you want to give away a course for free, the only easy way to do it is to use a checkout form, which isn't really designed for free giveaways, so it can confuse to the customer and make them worry that they're getting tricked into paying something.

However, help is at hand in the shape of the ThriveCart API, which doesn't get a lot of attention, but has a helpful function to create a new student.

Here's the PHP script:

<?php // Adds a student to a course based on an ActiveCampaign webhook.

//THRIVECART_API_KEY is from Thrivecart > Settings > API & Webhooks
$apiKey='YOUR_THRIVECART_API';	

//Set your confirmation action to https://YOURDOMAIN>COM/YOURSCRIPT.php?email=%EMAIL%&course_id=THRIVECART_COURSE_ID

//THRIVECART_COURSE_ID is the course ID which you can get by going into the edit screen inside ThriveCart Learn. It is the last part of the URL


//set parameters from the URL
$course_id = $_GET['course_id'];
$email = $_GET['email'];

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://thrivecart.com/api/external/students',
CURLOPT_HTTPHEADER => ['Authorization: Bearer '.$apiKey ],  
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array(
  								
'email' => $email,
'course_id' => $course_id,
'trigger_emails' => 'true', // This sends the signin link from Thrive for new & existing customers


//Optional extra data
//'name' => 'Jane Smith',  // Name not used in opt-in form				
//'tags[]' => 'api-student',  								//'order_info[order_id]' => '9938882',					//'order_info[purchase_type]' => 'product',			//'order_info[purchase_id]' => '5'
  								  								)
));

$response = curl_exec($curl);

curl_close($curl);

$object = json_decode($response);
$autoSignInUrl = $object->auto_signin_url;

// Redirects to the ThriveCart Learn sign-in page where you create a password to finish up creating the account
header("Location: ".$autoSignInUrl );
die();



Is your marketing funnel making sales every day?

Find out how our funnel management strategy acquires and converts more customers.

Start Here...