LearnDash Automations
Enrol a User on a LearnDash Course When a WooCommerce Product Is Purchased
You sell course access as a WooCommerce product — alongside, or instead of, LearnDash's own checkout options — and want the buyer enrolled automatically instead of by hand. Zapify does this with the A product is purchased trigger (WooCommerce) and the Enrol a user on a course action (LearnDash). Both integrations combine here; LearnDash is a Zapify PRO integration.
What this automation does
The automation is one trigger plus one action:
- Trigger: A product is purchased (
WC_PRODUCT_PURCHASED, WooCommerce) - Action: Enrol a user on a course (
LEARNDASH_ENROL_USER, LearnDash)
When the WooCommerce product you choose is purchased, Zapify enrols the buyer on the LearnDash course you specify.
The action calls LearnDash's own ld_update_course_access() function rather than writing enrolment data directly, so it behaves exactly like a normal enrolment — including anything else on the site that listens for one.
Before you start
- WooCommerce and LearnDash must both be installed and active.
- Zapify PRO must be active, since enrolling on LearnDash is a PRO action.
- You need the product that should grant access, and the course ID it should unlock. Find the ID in the course's edit URL in your WordPress admin —
post.php?post=123&action=editmeans the ID is123.
PRO feature
The Enrol a user on a course action (LEARNDASH_ENROL_USER) is part of the LearnDash PRO integration. The A product is purchased trigger itself is free (WooCommerce).
How to build the automation
Step 1: Create a new automation
- In the WordPress admin, go to Zapify → Automations.
- Click Add New to open the builder.
- Name it clearly, such as Enrol buyer on LearnDash course after purchase.

Step 2: Add the "A product is purchased" trigger
- Click Add Trigger.
- Choose WooCommerce as the app.
- Select the trigger A product is purchased.
- In the trigger's Product field, select the specific product that should unlock the course.



Leaving the Product field empty runs the automation for every purchase on the store, which is only useful if every product should grant the same course access — for this use case, select the specific product.
Step 3: Add the "Enrol a user on a course" action
- Click Add Action.
- Choose LearnDash as the app.
- Select Enrol a user on a course.



Step 4: Configure the action
| Field | Required | What it does |
|---|---|---|
| Course | Yes | The course ID the buyer should be enrolled on. Usually typed directly, since it isn't the token from this trigger. |
| User | No | Leave empty to use the person the automation is running for — the buyer. Fill it in only to enrol someone else. |
| Remove access instead | No | Off (default) enrols. Turn it on to build the opposite automation — see remove LearnDash course access when a WooCommerce order status changes for a related pattern. |

Step 5: Set the steps Live and save
- Set both the trigger and the action to Live.
- Click Save.

Tokens this action makes available
| Token | What it holds |
|---|---|
| Course ID | The course ID that was enrolled. |
| User ID | The ID of the user who was enrolled. |
How to test it
- Place a test order for the selected WooCommerce product and mark it as paid (or use a test payment gateway).
- Log in to LearnDash as that customer, or check their enrolment from the admin side, to confirm they now have access.
- If access wasn't granted, open Zapify → Logs — a failed enrolment reports the reason LearnDash gave.
Conclusion
With the A product is purchased trigger and the Enrol a user on a course action, Zapify sells LearnDash course access through your existing WooCommerce store without manual enrolment. Next, put buyers straight into a cohort group instead with add a user to a LearnDash group when a product is purchased, or compare plans in Zapify Free vs Pro.
FAQs
Can one WooCommerce product unlock more than one course?
Yes. Add a separate Enrol a user on a course action for each course, each with its own course ID.
Is this feature free?
The A product is purchased trigger is free. The Enrol a user on a course action is part of the LearnDash PRO integration, so it needs an active PRO licence.
Does this replace LearnDash's own checkout options?
No. It's an alternative way to grant access — useful when you'd rather sell through WooCommerce. You can use either checkout, or both, on different products.
Do I need to know the exact course ID?
Yes. Open the course in your WordPress admin and copy the ID from the edit URL.
What happens if the enrolment fails?
The action reports a failure — for example if the course ID doesn't exist or LearnDash isn't active — and that failure is visible in Zapify → Logs, so you can spot and fix a misconfigured course ID.
Do I need to write any code?
No. Everything is configured in the Zapify visual builder.