A checkout flow lets you change a Blackbaud Altru checkout form for specific items only. You choose which items it targets (by matching the item name), which page it runs on (checkout, cart or confirmation), and the JavaScript it runs, either on page load or dynamically each time the page updates. In this example, a checkout flow relabels Registrant 1 as Parent/Guardian 1 on every camp registration.
Before you start: your checkout flow embed code must be installed in Altru. See how to enable checkout flows with Altru.
Steps
- Pick the problem and the item (0:35). Here, people buying a camp kept entering the child’s information where the parent’s belonged, so the goal is to rename Registrant to Parent/Guardian on any camp form (0:49).
- Add a checkout flow (1:35). Click Add a checkout flow, give it any name, and click Next.
- Match the items to target (1:49). Choose one of three options:
- Matches exactly: one specific item, such as One Day Camps.
- Contains value: every item whose name contains the value, such as Camp. This is used in the video so it covers all the different camps.
- Does not contain value: every item that does not contain the value.
- Choose where it runs (2:43). Select the checkout page and add a few notes about what the flow does.
- Choose when the code runs (3:00). Page load JavaScript runs once when the page loads. Dynamic JavaScript runs every time the page is re-evaluated, which typically happens when the buyer triggers an Ajax request in Altru after the page has loaded. Use dynamic here, because the registrant fields only appear after the buyer enters a quantity and clicks Register.
- Paste your code (4:05). The example code renames Registrant to Parent/Guardian and keeps the number and colon. Click Next.
- Cart and confirmation pages, then enable (4:31). You can add code for the cart page (for example, to react when cart items change or a donation is added) and the confirmation page. Then turn on Enable this rule and click Next.
- Review and create (4:51). Check the summary and click Create checkout flow.
- Test it (5:06). Refresh the camp form, enter a quantity and click Register. Each label now reads Parent/Guardian 1, Parent/Guardian 2 and so on, and it updates again whenever the quantity changes.
Common questions
What can a checkout flow do?
Anything your JavaScript can do on the page for the targeted items, such as renaming labels, hiding or showing fields, or adding context. See how to customize Altru web forms with an online template for changes that apply to every form.
Should I use page-load or dynamic JavaScript?
Use page load for content that is there when the page opens. Use dynamic for content that appears or changes after the buyer interacts, such as registrant fields that appear after choosing a quantity.
My checkout flow isn’t working. What should I check?
Debug the code in the flow first (6:03). If you still can’t get it to run, disable it until it’s fixed.
How do I keep many checkout flows manageable?
Only keep the rules you need, trash ones you no longer use, and keep each flow’s notes current so a colleague can see what it does.
Video transcript
Hey, this is Rick from Social Good Software. In this short guide I’ll show you how to create a checkout flow, and we’ll walk through every step.
If you haven’t seen the previous video, where we gave a high-level view of how checkout flows are put together, I’d highly recommend watching it first so you understand what we’re doing today.
Let’s dig into the problem we’re solving with this checkout flow. Like I mentioned before, a checkout flow can target specific items being purchased, and it’s triggered based on the item being purchased. The item we’re targeting is camp, and more specifically any camp being purchased. If I enter one here, you’ll see the camp and all the information about it. What we want to do is replace “Registrant 1” with parent or guardian information wherever it appears, because a lot of people have been filling out this form with the kid’s information instead of the parent’s.
So let’s create a checkout flow. I click Add a checkout flow, and it asks for a name. You can name it anything you want. Then click Next. Here are the three options. We can match exactly, so if we only want this checkout flow to run for one-day camps, we say “One Day Camps”. If we want it to run on every item that contains “camp”, we can do that. And the other option is “does not contain value”, if you want it to run on every form that doesn’t have camp in it. I want “contains”, because there are different camps and we want this checkout flow to work with all of them. Then put in the value, which is “Camp”. Keep in mind the value is case sensitive: if it’s lowercase, use lowercase, and if it’s uppercase, use uppercase.
I click Next, and now we have three options for where this checkout flow runs. We want it to run only on the checkout page, not on other pages. I’ll add a couple of notes here.
Now we have a couple of options for what we want to do. We can write our own JavaScript code that’s triggered either on page load, which is this option, or every time the JavaScript gets re-evaluated. That typically happens when a user makes an Ajax request with Altru after the page has loaded, and that’s exactly what we want. If we refresh the form, at this point we don’t know what number they’re going to enter until they enter it. I’ll type in three and click Register, and you see it puts in Registrant 1, and further down Registrant 2, and so on. So we want to run this code after they’ve entered the number, and that’s what dynamic JavaScript means.
I have the code here, so I’ll paste it in. All this code does is find “Registrant”, rename it to “Parent/Guardian”, and keep the number, the colon and the value. That’s all this little JavaScript rule does. I’m happy with it, so I click Next.
You can do the same thing for the cart page if you want to make changes there, including when cart items change or a donation is added. Then the confirmation page. Then you get the option to enable this rule, so I enable it and click Next. I get an overview of everything we walked through, I’m happy with it, so I click Create checkout flow.
At this point the checkout flow has been created, and you can test it to see if it works. I refresh the page, select one, click Register, and now it says “Parent/Guardian 1”. If I scroll down there’s only one. If I go back up, type in three and update the quantities, there’s Parent/Guardian 1, Parent/Guardian 2 and Parent/Guardian 3. That’s all this checkout flow does: it renames the label from Registrant to Parent/Guardian. Every time the buyer changes the quantity, say down to two, it renames them again, because new items are added every time they update that value.
If you find errors in a checkout flow and it’s not working, I recommend debugging the code you’re working on. If you still can’t get it to run, or there are more issues, disable it. Once you get going, you may have 10, 20 or 30 checkout flows running on those pages, so keep a tidy workspace. Only keep the rules you need. If you’re no longer using them, trash them. If they need notes, update them, so when somebody else comes in they can quickly read and understand what each checkout flow does. If you have any questions, reach out. We’re always happy to help.



