30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

LearnDash Manage Product Courses

learndash/manage-product-courses adds or removes the LearnDash courses and groups a WooCommerce product grants.

It only affects future purchases.

At a glance

Abilitylearndash/manage-product-courses
ToolsetLearnDash — toolset/learndash
GroupLearnDash › Integrations & Add-ons
RequiresAcrossAI Pro, plus LearnDash LMS active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI 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

NameTypeRequiredWhat it is
product_idintegerYesThe WooCommerce product.
add_coursesarrayNoCourse IDs to grant on purchase.
remove_coursesarrayNoCourse IDs to stop granting.
add_groupsarrayNoGroup IDs to grant on purchase.
remove_groupsarrayNoGroup IDs to stop granting.

What comes back

NameTypeWhat it is
product_idintegerThe product.
grantsobjectWhat it grants afterwards.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent 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


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading