wc_get_attribute_terms: list attribute terms

Lists the values a global attribute offers — the sizes, the colours, the materials.

Arguments

Argument Required Meaning
attribute_id Yes The attribute, from wc_get_product_attributes
page No Page number, starting at 1
per_page No Page size, default 20 and maximum 100

Permissions

mcp:read and woocommerce:catalog:read, plus manage_woocommerce or edit_products.

What it returns

items, each with id, name and slug.

The slug is the one that matters for variation work: it is the value that goes into a variation's attributes map. The name is for humans.

Terms with no products attached are included, so this is the full vocabulary, not just what is currently in use.

An empty list is ambiguous

You get items: [], with no error, when:

  • the attribute genuinely has no terms yet;
  • the attribute_id does not correspond to any attribute.

The tool does not distinguish them. Confirm the ID against wc_get_product_attributes before concluding an attribute is empty — a mistyped ID looks exactly like a newly created attribute nobody has populated.

Newly created attributes start empty

Create the global attribute, refresh discovery in a new request, then create its values with wp_create_term using its registered pa_ taxonomy. Term tools require the content write gate and the taxonomy capabilities. Each creation needs approval.

The slugs must match exactly

A variation's attributes map is matched against these slugs. Near-misses do not warn:

  • large is not l
  • dark-blue is not darkblue
  • a label the assistant inferred ("Extra Large") is not a slug

Get the list, use the slugs verbatim, and never let a variation be built from a value that was guessed.

List the terms for attribute 3 and show me the slugs exactly as stored.

Custom attributes are not here

This tool reads the terms of global attributes only. A product using per-product custom attributes has its values stored on the product, and you read those through wc_get_product.

Using it well

Before building variations:

Show me the terms for the Size and Colour attributes with their slugs.

Checking coverage:

Product 219 has 8 variations. Given the terms of its attributes, which combinations are missing?

That question is answerable only with this listing, and it catches the gap customers notice: a combination advertised on the product page that cannot be selected.

Common problems

Symptom Cause
An empty list No terms yet, or an attribute_id that does not exist
pom_ai_mcp_wc_forbidden Missing shop capability
A variation built from these terms is not selectable A slug was altered or guessed
A term you expected is missing It belongs to a different attribute, or is a custom value
You cannot add a term Use wp_create_term with the registered taxonomy and its required permissions