• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Damien Carbery - Website Development

Getting You Online & Keeping You There

Getting You Online & Keeping You There Get Started
  • Home
  • Services
  • Maintenance Plans
  • Portfolio
  • Blog
  • About Me
  • Contact
You are here: Home / Website Development / Duplicate a ThriveCart order in WooCommerce

Duplicate a ThriveCart order in WooCommerce

Published: June 3, 2019

Duplicate a ThriveCart order in WooCommerce

After reading my Create WooCommerce order for new customers post a guy contacted me to help him create orders on his WooCommerce site for courses that are delivered by Sensei LMS. The courses are being sold via ThriveCart, a hosted shopping cart.

Zap

The guy uses Zapier as a bridge between ThriveCart and a number of other services that he uses e.g. ActiveCampaign. Via a Skype shared screen call he showed me the details of some of the zaps.

He needed a bridge to automatically create a WooCommerce order when a ThriveCart order is generated.

Webhooks

I browsed the ThriveCart docs and, instead of searching for a ThriveCart-WooCommerce zap, I found that ThriveCart has webhook notifications where it can pass order information to a url that you specify. The KB article gives example data.

REST API

I tried to use the WooCommerce REST API to create an order, using the provided sample code but I just could not get past the authentication. I felt that I was wasting a lot of time and not getting anywhere so I went back to the code from the post that prompted the initial contact.

Unit Development

I began working on a standalone script that would be called by ThriveCart. I couldn’t use my original code because it was an internal action triggered by the creation of a WooCommerce order, not by an external site. I found code on Stack Overflow to create a WooCommerce order.

I ran it alone and got it working after a few tweaks.

POSTMAN

The next step was to get the information from an external source (mimicking the ThriveCart webhook notification). I used the demo data provided in the ThriveCart KB article. I used Postman to call the script.

The code starts by verifying that the incoming data is authentic (the ‘thrivecart_account‘ and ‘thrivecart_secret‘ and then copies the customer data into the $address array. As the ThriveCart and WooCommerce product IDs are different I added an array to map ThriveCart product IDs to their corresponding WooCommerce products.

More Work

By developing the code in incremental bits debugging it was much easier.

The project is not yet complete. The next feature will be to ensure that the WooCommerce order creates the required connection to allow access to the Sensei course.

Reader Interactions

Leave a Reply Cancel reply

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


The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Blog Categories

  • Being Green
  • Food
  • Grammar
  • Just Strange
  • Laziness
  • Personal
  • Portfolio
  • Race Reports
  • Shudder
  • Typo
  • Website Development
  • WooCommerce Tips
  • Facebook
  • Twitter

Copyright © 2013–2023 Damien Carbery · Using Genesis Framework · Privacy Policy