learndash/manage-product-courses adds or removes the LearnDash courses and groups a WooCommerce product grants.
It only affects future purchases.
At a glance
| Ability | learndash/manage-product-courses |
| Toolset | LearnDash — toolset/learndash |
| Group | LearnDash › Integrations & Add-ons |
| Requires | AcrossAI Pro, plus LearnDash LMS active on the site |
| Capability | manage_options |
| Safety | Writes data |
| Repeatable | Idempotent — running it twice leaves the same result |
| Ships in | AcrossAI Pro 0.9.16 and later |
Existing customers are untouched
Customers who already bought the product keep whatever they were enrolled in at the time. Removing a course here does not revoke their access, and adding one does not grant it to them.
That is the correct behaviour — a purchase is a transaction that already happened — and it is not what people expect. Adding a course to a product does not upgrade the people who already bought it.
For existing customers, learndash/enroll-user and learndash/unenroll-user are the tools, applied per person or per group.
The operation is incremental: pass add_courses, remove_courses, add_groups and remove_groups as arrays, and anything you do not mention stays linked.
Linking a group rather than individual courses is usually the better structure on a site selling bundles, because changing what the bundle contains then changes what future purchases grant without touching the product.
Idempotent.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
product_id | integer | Yes | The WooCommerce product. |
add_courses | array | No | Course IDs to grant on purchase. |
remove_courses | array | No | Course IDs to stop granting. |
add_groups | array | No | Group IDs to grant on purchase. |
remove_groups | array | No | Group IDs to stop granting. |
What comes back
| Name | Type | What it is |
|---|---|---|
product_id | integer | The product. |
grants | object | What it grants afterwards. |
success | boolean | Whether the call completed. |
message | string | A one-line summary of what happened, suitable for showing a human. |
error_code | string | Present only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation. |
Example
Ask your assistant:
Make this product grant the advanced course too.
It resolves to one call:
{
"ability": "learndash/manage-product-courses",
"parameters": {
"product_id": 1200,
"add_courses": [418]
}
}Worth knowing
- Future purchases only. Existing customers are unaffected either way.
- Adding a course does not upgrade people who already bought.
- Use the enrolment abilities for existing customers.
- Linking a group makes bundle changes easier later.
Related abilities
- LearnDash List Course Products — check what it grants now
- LearnDash Enroll User — for customers who already bought
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category