View Categories

AI client access

8 min read

Let your AI assistant read recovery numbers through the WordPress Abilities API.

Every feature in CartWin is free. There is no paid version and nothing is locked.

What it does. Lets AI clients that speak the WordPress Abilities API (WordPress 6.9 and later) read the recovery numbers and change three settings — with the same rights as a store manager.

Why it matters. Ask your AI assistant “How many carts did we recover last week?” or “Which products are abandoned most?” and get the real numbers. “Pause the follow-ups” works too.

Details

Requirements

  • WordPress 6.9 or later. On an older WordPress nothing is registered and the plugin works as usual.
  • An AI client that supports the WordPress Abilities API. CartWin has no chat box of its own and talks to no AI service: the client calls the store, and the store answers with figures. No customer data leaves the store because of it.
  • A user who may manage WooCommerce (manage_woocommerce — an Administrator or a Shop Manager). Anonymous callers and Editors are refused. Each call is checked on its own.
  • On by default. There is no switch for it in the settings; a developer can switch it off (see below).

The four abilities

All four sit in the category cart-recovery (“CartWin”).

  1. cartwin/get-dashboard-stats — “Get cart recovery stats”
    – Input: { "days": 7 } — how many recent days, counting today. 1 to 366; 30 when left out.
    – Output:

    json
    {
    "days": 7,
    "abandoned": 42,
    "recovered": 11,
    "recovered_revenue": 1287.5,
    "recovery_rate": 26.2,
    "emails_sent": 38,
    "open_rate": 44.7,
    "click_rate": 18.4
    }

  • The figures are those of the Dashboard for the period. recovery_rate, open_rate and click_rate are numbers in percent — 44.7 means 44.7 %, not 0.447. emails_sent counts emails only; recovered_revenue is a plain number in the store’s currency.
    2. cartwin/get-product-stats — “Get abandoned cart stats per product”
  • Input: { "days": 30 }, as above.
  • Output: { "days": 30, "products": [ { "product_id": 61, "name": "Blue T-shirt", "abandoned": 14, "recovered": 5, "lost": 4, "revenue": 249.5 } ] }
  • At most 25 products, the most abandoned first.
    3. cartwin/get-settings — “Get cart recovery settings”
  • Input: none.
  • Output, eleven values:

    json
    {
    "cart_lost_minutes": 15,
    "cart_lost_days": 30,
    "emails_per_run": 20,
    "cron_minutes": 15,
    "enabled": true,
    "capture_enabled": true,
    "sending_enabled": true,
    "gdpr_enabled": true,
    "coupon_mode": "auto",
    "sms_enabled": false,
    "wa_enabled": false
    }

  • Secrets are never included: no keys, tokens or passwords, and no addresses.
    4. cartwin/update-settings — “Update cart recovery settings”

  • Input: any of cart_lost_minutes (1–1440), cart_lost_days (1–365) and sending_enabled (true or false). Only the fields that are given change.
  • Output: { "updated": [ "cart_lost_minutes", "sending_enabled" ] } — the names of the fields that were changed; an empty list when there was nothing to change.
  • { "sending_enabled": false } pauses the follow-ups; { "cart_lost_minutes": 30 } lets a cart count as abandoned after 30 quiet minutes.
  • A number outside its range is refused by WordPress before it reaches the plugin. Any other field in the input is ignored.

What the abilities cannot do

  • They cannot send, re-queue or delete messages, carts or templates. They cannot change texts, coupons, API keys or addresses. They cannot read a customer’s contact details — totals and figures only.
  • sending_enabled is the only switch that touches customers. Switching it on has the same effect as in the admin — every cart that is abandoned at that moment and not lost yet gets its follow-ups (3.6) — only that the engine runs at its next regular time, since no extra run is started from here. The change is written to the activity log.
  • Every change lands in the activity log as “Settings changed”, like a change made in the admin.

Switching the abilities off

On by default, with no switch in the settings. A developer switches them off with one line of code, run once — CartWin_Settings::update( array( 'abilities_enabled' => 0 ) ); — and on again with 1. See 15.7.

What you need: WordPress 6.9 or later, and an AI client that supports the WordPress Abilities API.

What it is for. You ask, the assistant reads the numbers from the store and answers: “How many carts did we recover this week?”, “Which five products are abandoned most?”, “Are the follow-ups switched on?”. It can also change three settings: Abandoned after, Lost after and Send follow-ups.

How to use it

  1. Connect the AI client to the site with a user who may manage WooCommerce — an Administrator or a Shop Manager. Editors and anonymous callers are refused.
  2. The four abilities are listed under the category CartWin: Get cart recovery stats, Get abandoned cart stats per product, Get cart recovery settings, Update cart recovery settings.
  3. Ask in plain words. The client picks the ability and passes on the number of days when the question names a period; without one, the last 30 days are used.
  4. Read the answer knowing that the rates are numbers in percent: an answer 42.5 for the recovery rate means 42.5 %.

What it cannot do. It cannot send, re-queue or delete anything, and it cannot change texts, coupons, keys or addresses. It never sees a customer’s name or contact details — only totals. The one switch with an effect on customers is Send follow-ups; the change is written to the activity log like any other.

Switching it off. There is no setting for it. A developer switches the abilities off with CartWin_Settings::update( array( 'abilities_enabled' => 0 ) ); and on again with 1 (see 15.7).

What is “AI client access”?
A way for AI assistants to read figures from CartWin and change three settings, through the WordPress Abilities API — the interface WordPress offers AI clients from version 6.9.

Is it switched on?
Yes, by default. There is no setting for it; a developer can switch it off (4.13).

Does CartWin send anything to an AI service?
No. CartWin has no AI service of its own and calls none. The AI client calls your store, and the store answers.

What can an AI assistant do with it?
Read the recovery figures of a period, read which products are abandoned most, read the main settings, and change Abandoned after, Lost after and Send follow-ups.

What can it not do?
Send, re-queue or delete messages, carts or templates; change texts, coupons, keys or addresses; read a customer’s name or contact details.

Who may use it?
Only a user who may manage WooCommerce — an Administrator or a Shop Manager. Editors and anonymous callers are refused.

Which AI tools support it?
Those that support the WordPress Abilities API. Ask the maker of your tool whether it does.

The assistant does not find CartWin’s abilities. Why?
Four common causes: the WordPress version is older than 6.9; the user the assistant acts for may not manage WooCommerce; the abilities were switched off by a developer; or the client does not support the Abilities API at all.

How do I switch it off?
There is no setting for it. A developer runs CartWin_Settings::update( array( 'abilities_enabled' => 0 ) ); once (15.7).

Does the assistant read the rates in percent?
Yes, as plain numbers: 44.7 means 44.7 %.

Check How
WordPress 6.9 or later? Dashboard → Updates. On an older WordPress the abilities are not registered.
Is the user allowed? The user the AI client acts for must be able to manage WooCommerce. Editors and anonymous callers are refused.
Switched off by a developer? CartWin_Settings::get( 'abilities_enabled' ) must be 1 (15.7).
Does the client support the Abilities API? Ask the maker of the tool. CartWin cannot make a client support it.
The figures look off by a factor of 100 The rates are numbers in percent: 44.7 means 44.7 %.
Ability Input Output
cartwin/get-dashboard-stats { "days": 1–366 } (default 30) days, abandoned, recovered, recovered_revenue, recovery_rate, emails_sent, open_rate, click_rate
cartwin/get-product-stats { "days": 1–366 } days, products[] with product_id, name, abandoned, recovered, lost, revenue
cartwin/get-settings {} cart_lost_minutes, cart_lost_days, emails_per_run, cron_minutes, enabled, capture_enabled, sending_enabled, gdpr_enabled, coupon_mode, sms_enabled, wa_enabled
cartwin/update-settings any of cart_lost_minutes (1–1440), cart_lost_days (1–365), sending_enabled (boolean) { "updated": [ …keys ] }

Permission: manage_woocommerce. Category: cart-recovery.

Units and types

  • recovery_rate, open_rate, click_rate are numbers in percent (44.7 = 44.7 %), not fractions.
  • recovered_revenue and revenue are plain numbers in the store’s currency, rounded to two decimals — no currency code is returned.
  • Booleans come back as real booleans; cart_lost_minutes and cart_lost_days are integers.
  • emails_sent counts email messages only.

Calling an ability from code

$stats = wp_get_ability( 'cartwin/get-dashboard-stats' )->execute( array( 'days' => 7 ) );
// array( 'days' => 7, 'abandoned' => 42, 'recovered' => 11, 'recovered_revenue' => 1287.5, … )

execute() does the checks itself, in this order: the input is validated against the schema (a number outside its range is refused before anything runs), then the permission callback is called. A caller who cannot manage WooCommerce gets a WP_Error with the code ability_invalid_permissions, and nothing is executed.

Switching the abilities off

The setting abilities_enabled (default 1) has no field in the settings screen. Switch it in code, once:

CartWin_Settings::update( array( 'abilities_enabled' => 0 ) ); // off
CartWin_Settings::update( array( 'abilities_enabled' => 1 ) ); // on again

The change is written to the activity log as “Settings changed”. Abilities are registered on wp_abilities_api_init; an older WordPress without the Abilities API registers nothing.


Was this helpful?

Still stuck? Write to [email protected] with a screenshot and a description.

Download CartWin — it’s free

← Previous: Webhooks & automation   |   Next: Languages →