Does anyone know if it’s possible to compose a link that will pre-populate a shopping cart with specific courses/sessions and a coupon code?
Here’s the scenario:
Marketing sends out an invitation to sign up for some classes by calling a telephone agent.
The telephone agent finds the specific courses and sessions that a student wants, perhaps by putting them into that agent’s temporary cart or using a special tool we could build.
The telephone agent also puts in a specific discount coupon code.
We want a special link that contains all of the cart information (courses and discounts) that can be sent by email to the student so that they can complete the sale in their own account. When the student clicks on that link, they’re taken to the pre-populated shopping cart to complete the purchase.
Note that we do not want to bypass the shopping cart the way that enrollment links do.
Has anyone done this or know of a way to do it?
Page 1 / 1
Well… I decided to dig a bit deeper into how the shopping cart works, and have come up with the beginnings of a solution.
Let’s start with a simple scenario… Let’s say you want to have an “easy button” to add a special “late fee” fake eLearning course to the shopping cart. This can be accomplished with Javascript and what is called a bookmarklet (a bookmark that contains javascript code instead of typical link).
Steps in Chrome:
Create a fake eLearning class called “Late Fee” or similar.
Set the price.
For now, put the course in a catalog that only you can see.
Add the fake course to the shopping cart.
Right-click the page and choose “Inspect” (or CTRL-Shift-I)
Select the Application tab from the developer tools (top bar of the tools).
Scroll down on the left side to Local storage, and expand it so you can see your site.
Scroll down to the key called “docebo_cart_data”.
Copy the value there and paste it into Notepad.
Modify the following code, replacing YOUR-CODE-HERE with what you pasted into Notepad previously. Note that your original code will be an array (in square brackets). You will need to remove those brackets and just keep everything inside the curly braces.
Create a new bookmarklet. Right-click your bookmarks bar, then click "Add page..." or go to your Bookmarks manager, then right-click and click "Add new bookmark". The name can be anything you want. Just paste your Javascript code into the URL like so:
Technically you can use this bookmarklet/link anywhere on your site, but it makes the most sense to use it while you’re in the shopping cart.
OPTIONAL: If you’re really going to do a “late fee”, you probably want that course hidden from the transcript, and able to be purchased again. To do that, you’ll need to create a webhook that is triggered from enrollment, filtered for that course, and that will archive and reset the tracking. Let me know if you need directions on how to create this automation.
This basic idea can be expanded in the following ways:
Pre-create a shopping cart of multiple items--a bundle of courses.
Expand the code to include a coupon code that might only be good for the bundle of courses above. You’ll want to target the “docebo_applied_coupon” key and remember that you can have only one coupon per cart, and the value will be a simple collection--not an array. There are a couple other things to watch for with the coupon, but I can expand on that later if desired.
Unsupported: If you know how to add JavaScript to your site, you can create a page on your LMS site with a button that will automatically do all of the above).