Overview
↑ Back to topMemberships version 1.28.0 started registering abilities with the WordPress Abilities API, which was introduced in WordPress core version 6.9.
This reference documents the available abilities.
The input and output schemas are provided below as a reference, but they can also be achieved using Abilities API methods. For example:
$ability = wp_get_ability( 'woocommerce-memberships/plans-get' );
echo '<pre>';
echo json_encode($ability->get_input_schema(), JSON_PRETTY_PRINT);
echo json_encode($ability->get_output_schema(), JSON_PRETTY_PRINT);
echo '</pre>';
Plans
↑ Back to topAbilities in the woocommerce-membership-plans category operate on membership plan objects.
In PHP, abilities that return a plan will return an instance of WC_Memberships_Membership_Plan. This class implements the JsonSerializable interface, so when the ability is invoked through a serialized surface (REST API, WP-CLI, or other API contexts), the plan is automatically converted to its serialized representation:
{
"id": 30,
"name": "Silver Membership",
"slug": "silver-membership",
"status": "publish",
"description": "",
"access": {
"method": "purchase",
"product_ids": [24]
},
"membership_length": {
"type": "unlimited"
},
"rules": {
"content_restriction": [
{
"id": "rule_66828c2d824b2",
"content_type": "post_type",
"content_type_name": "page",
"object_ids": [70, 152],
"access_schedule": {
"type": "immediate"
}
}
],
"product_restriction": [],
"purchasing_discount": [
{
"id": "rule_666af6f316817",
"content_type": "post_type",
"content_type_name": "product",
"object_ids": [],
"active": true,
"discount_type": "amount",
"discount_amount": "5"
}
]
}
}
The access, membership_length, and rules objects are polymorphic — their shape varies depending on the plan’s configuration. For example, membership_length only includes amount and period when the type is specific, and only includes start_date and end_date when the type is fixed.
All plan abilities require the manage_woocommerce capability.
woocommerce-memberships/plans-create
↑ Back to topCreates a new membership plan with the provided input parameters.
Permission: manage_woocommerce
Input Schema
{
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true,
"description": "The plan name."
},
"slug": {
"type": "string",
"description": "The plan slug."
},
"status": {
"type": "string",
"enum": [
"draft",
"publish"
],
"description": "The plan status."
},
"description": {
"type": "string",
"description": "The plan description."
},
"access": {
"type": "object",
"description": "Access settings.",
"properties": {
"method": {
"type": "string",
"enum": [
"manual-only",
"signup",
"purchase"
]
},
"product_ids": {
"type": "array",
"items": {
"type": "integer"
},
"description": "Required when method is 'purchase'."
}
}
},
"membership_length": {
"type": "object",
"description": "Membership length settings.",
"properties": {
"type": {
"type": "string",
"enum": [
"unlimited",
"specific",
"fixed"
]
},
"amount": {
"type": "integer",
"description": "Required when type is 'specific'."
},
"period": {
"type": "string",
"enum": [
"days",
"weeks",
"months",
"years"
],
"description": "Required when type is 'specific'."
},
"start_date": {
"type": "string",
"format": "date",
"description": "Required when type is 'fixed'."
},
"end_date": {
"type": "string",
"format": "date",
"description": "Required when type is 'fixed'."
}
}
},
"rules": {
"type": "object",
"description": "Plan rules.",
"properties": {
"content_restriction": {
"type": "array",
"items": {
"title": "Content Restriction",
"type": "object",
"properties": {
"content_type": {
"type": "string",
"enum": [
"post_type",
"taxonomy",
""
],
"required": true
},
"content_type_name": {
"type": "string",
"required": true
},
"object_ids": {
"type": "array",
"items": {
"type": "integer"
},
"required": true,
"description": "Targeted object IDs. Empty array means all objects of the content type."
},
"access_schedule": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"immediate",
"delayed"
],
"required": true
},
"amount": {
"type": "integer",
"required": false,
"description": "Only present when type is 'delayed'."
},
"period": {
"type": "string",
"enum": [
"days",
"weeks",
"months",
"years"
],
"required": false,
"description": "Only present when type is 'delayed'."
}
}
}
}
}
},
"product_restriction": {
"type": "array",
"items": {
"title": "Product Restriction",
"type": "object",
"properties": {
"content_type": {
"type": "string",
"enum": [
"post_type",
"taxonomy",
""
],
"required": true
},
"content_type_name": {
"type": "string",
"required": true
},
"object_ids": {
"type": "array",
"items": {
"type": "integer"
},
"required": true,
"description": "Targeted object IDs. Empty array means all objects of the content type."
},
"access_schedule": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"immediate",
"delayed"
],
"required": true
},
"amount": {
"type": "integer",
"required": false,
"description": "Only present when type is 'delayed'."
},
"period": {
"type": "string",
"enum": [
"days",
"weeks",
"months",
"years"
],
"required": false,
"description": "Only present when type is 'delayed'."
}
}
},
"access_type": {
"type": "string",
"required": true
}
}
}
},
"purchasing_discount": {
"type": "array",
"items": {
"title": "Purchasing Discount",
"type": "object",
"properties": {
"content_type": {
"type": "string",
"enum": [
"post_type",
"taxonomy",
""
],
"required": true
},
"content_type_name": {
"type": "string",
"required": true
},
"object_ids": {
"type": "array",
"items": {
"type": "integer"
},
"required": true,
"description": "Targeted object IDs. Empty array means all objects of the content type."
},
"active": {
"type": "boolean",
"required": true
},
"discount_type": {
"type": "string",
"enum": [
"percentage",
"amount"
],
"required": true
},
"discount_amount": {
"type": [
"string",
"number"
],
"required": true
}
}
}
}
}
}
}
}
Output
Returns a WC_Memberships_Membership_Plan object on success, or a WP_Error instance on failure.
Example
$ability = wp_get_ability('woocommerce-memberships/plans-create');
$plan = $ability->execute([
'name' => 'Gold Membership',
'status' => 'publish',
'access' => [
'method' => 'purchase',
'product_ids' => [24],
],
'membership_length' => [
'type' => 'specific',
'amount' => 12,
'period' => 'months',
],
'rules' => [
'content_restriction' => [
[
'content_type' => 'post_type',
'content_type_name' => 'post',
'object_ids' => [],
],
],
'purchasing_discount' => [
[
'content_type' => 'post_type',
'content_type_name' => 'product',
'object_ids' => [79, 80],
'active' => true,
'discount_type' => 'percentage',
'discount_amount' => 10,
],
],
],
]);
woocommerce-memberships/plans-get
↑ Back to topRetrieves a membership plan by ID.
Permission: manage_woocommerce
Input Schema
{
"type": "integer",
"description": "The membership plan ID.",
"required": true,
"minimum": 1
}
Output
Returns a WC_Memberships_Membership_Plan object on success, or a WP_Error instance on failure.
Example
$ability = wp_get_ability('woocommerce-memberships/plans-get');
$plan = $ability->execute(30);
woocommerce-memberships/plans-list
↑ Back to topRetrieves a collection of membership plans. Accepts standard WP_Query arguments as input — any valid WP_Query parameter may be passed through.
Permission: manage_woocommerce
Input
The below input is not exhaustive. See WP_Query documentation for a complete reference.
{
"type": "object",
"default": [],
"additionalProperties": true,
"description": "Accepts standard WP_Query arguments. Common parameters are listed below; any valid WP_Query parameter may be used.",
"properties": {
"posts_per_page": {
"type": "integer",
"description": "Number of plans to return. Use -1 for all.",
"default": -1
},
"paged": {
"type": "integer",
"description": "Page number when paginating results.",
"minimum": 1
},
"offset": {
"type": "integer",
"description": "Number of plans to skip before returning results."
},
"post_status": {
"type": "string",
"description": "Plan status. Accepts any valid post status (e.g. 'publish', 'draft', 'any').",
"default": "publish"
},
"post__in": {
"type": "array",
"description": "Limit result set to specific plan IDs.",
"items": {
"type": "integer"
}
},
"post__not_in": {
"type": "array",
"description": "Exclude specific plan IDs from the result set.",
"items": {
"type": "integer"
}
},
"post_name__in": {
"type": "array",
"description": "Limit result set to plans with specific slugs.",
"items": {
"type": "string"
}
},
"orderby": {
"type": "string",
"description": "Sort plans by parameter (e.g. 'date', 'title', 'modified', 'ID')."
},
"order": {
"type": "string",
"description": "Sort order.",
"enum": [
"ASC",
"DESC"
]
}
}
}
Output
Returns an array of WC_Memberships_Membership_Plan objects.
Example
$ability = wp_get_ability('woocommerce-memberships/plans-list');
// all published plans (default)
$plans = $ability->execute();
// draft plans only
$plans = $ability->execute([
'post_status' => 'draft',
]);
woocommerce-memberships/plans-delete
↑ Back to topDeletes a membership plan by ID. Plans with active memberships cannot be deleted.
Permission: manage_woocommerce
Input Schema
{
"type": "integer",
"description": "The membership plan ID.",
"required": true,
"minimum": 1
}
Output
Returns the deleted WC_Memberships_Membership_Plan object on success, or a WP_Error instance on failure.
Example
$ability = wp_get_ability('woocommerce-memberships/plans-delete');
$deletedPlan = $ability->execute(30);
User Memberships
↑ Back to topAbilities in the woocommerce-user-memberships category operate on user membership objects.
In PHP, abilities that return a user membership will return an instance of WC_Memberships_User_Membership. This class implements the JsonSerializable interface, so when the ability is invoked through a serialized surface (REST API, WP-CLI, or other API contexts), the membership is automatically converted to its serialized representation:
{
"id": 1234,
"plan_id": 30,
"user_id": 40,
"status": "active",
"start_date": "2026-03-01T00:00:00+00:00",
"end_date": null,
"cancelled_date": null,
"paused_date": null,
"order_id": 567,
"product_id": 24
}
Date fields (start_date, end_date, cancelled_date, paused_date) are ISO 8601 strings or null. The order_id and product_id fields are integers when the membership was granted via a purchase, or null for manually-assigned memberships.
All user membership abilities require the manage_woocommerce capability.
woocommerce-memberships/user-memberships-create
↑ Back to topCreates a new user membership.
Permission: manage_woocommerce
Input Schema
{
"type": "object",
"properties": {
"plan_id": {
"type": "integer",
"required": true,
"minimum": 1,
"description": "The membership plan ID to assign the user to."
},
"user_id": {
"type": "integer",
"required": true,
"minimum": 1,
"description": "The user ID to create the membership for."
},
"product_id": {
"type": "integer",
"minimum": 1,
"description": "The product ID that granted access (optional)."
},
"order_id": {
"type": "integer",
"minimum": 1,
"description": "The order ID that contained the access-granting product (optional)."
}
}
}
Output
Returns a WC_Memberships_User_Membership object on success, or a WP_Error instance on failure.
Example
$ability = wp_get_ability('woocommerce-memberships/user-memberships-create');
$membership = $ability->execute([
'plan_id' => 30,
'user_id' => 40,
]);
woocommerce-memberships/user-memberships-get
↑ Back to topRetrieves a user membership by ID.
Permission: manage_woocommerce
Input Schema
{
"type": "integer",
"description": "The user membership ID.",
"required": true,
"minimum": 1
}
Output
Returns a WC_Memberships_User_Membership object on success, or a WP_Error instance on failure.
Example
$ability = wp_get_ability('woocommerce-memberships/user-memberships-get');
$membership = $ability->execute(1234);
woocommerce-memberships/user-memberships-list
↑ Back to topRetrieves user memberships for a given user. Requires a user_id. Optionally filters by membership status — accepts a single status string or an array of statuses.
Permission: manage_woocommerce
Input Schema
{
"type": "object",
"default": [],
"properties": {
"user_id": {
"type": "integer",
"required": true,
"minimum": 1,
"description": "The user ID to retrieve memberships for."
},
"status": {
"type": [
"string",
"array"
],
"items": {
"type": "string"
},
"description": "Filter by membership status. A single status string or an array of statuses (e.g. 'active', ['active', 'expired'], 'any').",
"default": "any"
}
}
}
Output
Returns an array of WC_Memberships_User_Membership objects.
Example
$ability = wp_get_ability('woocommerce-memberships/user-memberships-list');
// all memberships for a user
$memberships = $ability->execute([
'user_id' => 40,
]);
// only active memberships
$memberships = $ability->execute([
'user_id' => 40,
'status' => 'active',
]);
// active or paused memberships
$memberships = $ability->execute([
'user_id' => 40,
'status' => ['active', 'paused'],
]);
woocommerce-memberships/user-memberships-delete
↑ Back to topDeletes a user membership by ID.
Permission: manage_woocommerce
Input Schema
{
"type": "integer",
"description": "The user membership ID.",
"required": true,
"minimum": 1
}
Output
Returns the deleted WC_Memberships_User_Membership object on success, or a WP_Error instance on failure.
Example
$ability = wp_get_ability('woocommerce-memberships/user-memberships-delete');
$deletedMembership = $ability->execute(1234);
MCP Integration
↑ Back to topData Privacy Notice
While Memberships abilities don’t expose contact details (e.g. name, address, email) in their responses, identifiers like user_id and order_id can be linked to personal data that is stored elsewhere. A connected MCP client may have access to additional WooCommerce tools that return more direct personal data. You are responsible for ensuring compliance with applicable data protection regulations.
As of v1.28.0, WooCommerce Memberships does not expose abilities to the WooCommerce MCP server by default. If you’d like to enable MCP access to Memberships abilities, you can use the following snippet to expose them to the WooCommerce MCP server:
add_filter('woocommerce_mcp_include_ability', function ($include, $ability_id) {
if (str_starts_with($ability_id, 'woocommerce-memberships/')) {
return true;
}
return $include;
}, 10, 2);