Letting an AI assistant read your POP invoices (WordPress Abilities and WP-CLI)
Goal
Let an AI assistant connected to your WordPress site (or a command-line script) search invoices and credit notes already generated by POP on WooCommerce, Paid Memberships Pro, or Paid Member Subscriptions, and retrieve their XML, PDF, or structured data — without granting direct access to the database or the filesystem.
This is a different mechanism from POP’s hosted MCP server (see mcp and mcp-remote): that one talks to the POP Cloud API and creates new documents for any platform; this one works locally on your own WordPress site, on orders your store has already invoiced, and doesn’t generate anything new — it only serves already-cached documents.
Prerequisites
- pop-wordpress 6.9.11 or later.
- For the WP-CLI path: no other dependency, just shell/SSH access to the site.
- For the AI assistant path: the site needs a registered Abilities API (
wp_register_ability()function available, typically via the “Abilities API” plugin) and an MCP server exposing the site’s abilities (typically the “MCP Adapter” plugin) — pop-wordpress only registers its own abilities when these are present, and does nothing otherwise.
What it exposes
Four abilities, category pop:
pop/search-invoices— search invoices/credit notes by provider, customer, address, status, document type, or date range; returns document ids for use with the other three.pop/get-invoice-data— structured document data (invoice number, status, total, currency, dates, active fiscal channel, formats available in cache).pop/get-invoice-xml— cached XML (invoice/credit note).pop/get-invoice-pdf— cached PDF metadata and URL.
Steps
AI assistant path (Abilities/MCP)
- Install and activate the Abilities API and MCP Adapter plugins on the WordPress site, in addition to pop-wordpress.
- Connect your AI assistant to the site’s MCP server (address and authentication depend on the installed MCP Adapter plugin).
- Ask your assistant something like “Find July invoices for customer Smith”: the assistant uses
pop/search-invoices, thenpop/get-invoice-data/xml/pdfon the document it found.
By default, every ability requires the WordPress manage_options capability (filterable via
wc_el_inv-abilities-capability), because it’s reachable over HTTP.
WP-CLI path
wp popapi invoice search --customer="Smith" --date_from=2026-07-01
wp popapi invoice get <document_id> --provider=woocommerce
wp popapi invoice xml <document_id> --raw
wp popapi invoice pdf <document_id>
searchaccepts--provider,--customer,--address,--status,--document_type,--date_from,--date_to,--limit(default 10, capped at 50),--offset.get/xml/pdfrequire<document_id>as a positional argument, plus--provider(required when multiple providers are active on the site),--document_type,--parent_id(for credit notes).- All four accept
--format=table|csv|json|yaml|ids|countand--fields=<comma-separated list>. xml --rawprints only the XML content, with no metadata.
WP-CLI commands do not enforce the manage_options gate: shell/WP-CLI access to the site is already
a stronger trust boundary than a WordPress capability, so no --user is required.
Verify
wp popapi invoice search --format=count should return a number consistent with invoiced orders on the
site. On an existing document, wp popapi invoice get <id> --provider=<provider> should return
structured data with no errors.
Common errors
pop_ability_forbidden(403, AI path only) — the authenticated user lacks the required capability: check the role or thewc_el_inv-abilities-capabilityfilter.pop_ability_invalid_provider— the site has multiple providers active (e.g. WooCommerce and PMPro together) and you didn’t specify--provider/provider: the message lists the active providers to choose from.pop_ability_document_not_found— the document id doesn’t exist for the given provider/type.pop_ability_xml_not_found/pop_ability_pdf_not_found— the document has no cached XML/PDF: these abilities only serve already-generated documents, they don’t create new ones on the fly.- No ability registered (silent, no error) — the Abilities API/MCP Adapter plugins are missing: the WP-CLI path remains available regardless of these plugins.
Related configuration
To generate or send new documents from an AI assistant (not just retrieve existing ones), see mcp or mcp-remote, which work at the POP Cloud API level and don’t require extra WordPress plugins.