Skip to content
woo-customer-spend-tier-tagger logo

Woo Customer Spend Tier Tagger

woo-customer-spend-tier-tagger

Segment customers into Bronze, Silver, and Gold tiers based on lifetime total_spent and write the tier as a customer meta field.

SKILL.md

Full skill instructions

woo-customer-spend-tier-tagger

Purpose

Segment all customers by their total_spent value into configurable Bronze, Silver, and Gold tiers, then write the tier label as a meta_data field on each customer record. Useful for loyalty programs, email segmentation, and B2C personalization. Includes dry-run preview before any writes.

Prerequisites

  • WooCommerce store with REST API enabled (WooCommerce → Settings → Advanced → REST API)
  • Consumer Key and Consumer Secret with Read/​Write scope
  • Store accessible over HTTPS
  • Minimum WooCommerce version: 3.5.0

Parameters

ParameterTypeRequiredDefaultDescription
store_urlstringyes—Base URL of the WooCommerce store (e.g., https://mystore.com)
consumer_keystringyes—WooCommerce REST API consumer key (ck_...)
consumer_secretstringyes—WooCommerce REST API consumer secret (cs_...)
dry_runboolnotruePreview tier assignments without writing to customer records
formatstringnohumanOutput format: human or json
silver_thresholdnumberno200Minimum total_spent (store currency) for Silver tier
gold_thresholdnumberno1000Minimum total_spent (store currency) for Gold tier
meta_keystringno_loyalty_tierThe meta_data key to write on each customer
bronze_labelstringnoBronzeLabel written for Bronze tier customers
silver_labelstringnoSilverLabel written for Silver tier customers
gold_labelstringnoGoldLabel written for Gold tier customers
rolestringnocustomerWordPress user role to filter (use all for all roles)

Authentication

WooCommerce uses OAuth 1.0a for HTTP and Basic Auth over HTTPS.

For HTTPS stores (recommended):

Authorization: Basic base64(consumer_key:consumer_secret)

For HTTP stores (development only): Use OAuth 1.0a — include oauth_consumer_key, oauth_nonce, oauth_signature, oauth_signature_method=HMAC-SHA1, oauth_timestamp, oauth_version=1.0

Never log or output consumer_key or consumer_secret values.

See docs/​AUTHENTICATION.md for full setup instructions.

Safety

Step 4 executes customer meta writes. Always run with dry_run: true first (the default) and confirm the tier distribution preview before tagging live. Writing a meta field is non-destructive — re-running the skill updates the tier — but verify the threshold values match your program rules.

Workflow Steps

Step 1 — Fetch all customers

GET /​wp-json/​wc/​v3/​customers
  ?role=<role>
  &orderby=registered_date
  &order=asc
  &per_page=100
  &page=1

Extract per customer: id, first_name, last_name, email, total_spent, orders_count Paginate until response length < 100. Note total from X-WP-Total header.

Step 2 — Compute tier for each customer

if total_spent >= gold_threshold:
  tier = gold_label
elif total_spent >= silver_threshold:
  tier = silver_label
else:
  tier = bronze_label

Step 3 — Preview

If dry_run: true: output tier distribution summary and sample table, then stop.

Step 4 — Write tier meta

If dry_run: false and user has confirmed:

PUT /​wp-json/​wc/​v3/​customers/​{id}
  Body: {
    "meta_data": [
      { "key": "<meta_key>", "value": "<tier_label>" }
    ]
  }

Process in batches (sequential PUTs, not batch endpoint — customer batch is not available in WC core). Emit progress after every 50 customers.

API Endpoints Used

GET  /​wp-json/​wc/​v3/​customers        — list all customers with spend data
PUT  /​wp-json/​wc/​v3/​customers/​{id}   — write loyalty tier meta field

Pagination Strategy

WooCommerce REST API uses page/​per_page pagination (not cursor-based).

Standard pattern:

page = 1
while True:
  response = GET /​endpoint?per_page=100&page=page
  process(response)
  if len(response) < 100: break
  page += 1

Maximum per_page is 100 for most endpoints. The X-WP-Total and X-WP-TotalPages response headers report totals. Always read X-WP-TotalPages on the first request to estimate job size.

Session Tracking

Claude MUST emit the following output at each stage. This is mandatory.

STARTUP:

╔══════════════════════════════════════════╗
║  SKILL: woo-customer-spend-tier-tagger   ║
║  STORE: <store_url>                      ║
║  TIME:  <ISO-8601 UTC>                   ║
║  MODE:  <DRY RUN | LIVE>                 ║
╚══════════════════════════════════════════╝

PER-OPERATION (emit after each API call batch):

[N/​TOTAL] <METHOD> <endpoint> → <result_count> records | params: <key>=<val>

COMPLETION (human format):

╔══════════════════════════════════════════╗
║  COMPLETE: woo-customer-spend-tier-tagger║
║  RECORDS PROCESSED: <n>                  ║
║  OUTPUT: <filename or "stdout">          ║
╚══════════════════════════════════════════╝

COMPLETION (json format):

{
  "skill": "woo-customer-spend-tier-tagger",
  "store": "<store_url>",
  "completed_at": "<ISO-8601>",
  "records_processed": <n>,
  "output_file": "<path or null>",
  "dry_run": <bool>
}

Output Format

Dry-run / preview (human format):

TIER PREVIEW — 1,284 customers (DRY RUN)
Thresholds: Bronze < $200 | Silver $200–$999 | Gold ≥ $1,000

  Tier     Count    % of Base    Avg Spend    Total Spend
  ──────────────────────────────────────────────────────
  🥇 Gold     84       6.5%       $2,341       $196,644
  🥈 Silver  321      25.0%         $412       $132,252
  🥉 Bronze  879      68.5%          $67        $58,893
  ──────────────────────────────────────────────────────
  Total    1,284     100.0%         $301       $387,789

Top 5 Gold customers:
  #  Email                   Total Spent   Orders
  1  [email protected]       $8,421        47
  2  [email protected]         $6,102        31
  ...

CSV filename: woo-customer-spend-tier-tagger_<YYYY-MM-DD>.csv Columns: customer_id, email, first_name, last_name, total_spent, orders_count, tier, meta_key, meta_value

Error Handling

ErrorCauseResolution
401 UnauthorizedInvalid or missing credentialsVerify consumer_key and consumer_secret
403 ForbiddenConsumer Key lacks Read/​Write scopeRegenerate key with Read/​Write scope
404 Not FoundCustomer ID not found during PUTCustomer may have been deleted; skip and continue
429 Too Many RequestsRate limit during sequential PUTsWait 2 seconds between batches of 50
woocommerce_rest_* errorValidation failureSee message in response JSON

Best Practices

  • Run with dry_run: true first (the default). Review the tier distribution before tagging.
  • Export the CSV after tagging for use in your email marketing platform.
  • Re-run monthly to keep tiers current as customers' spend evolves.
  • Use meta_key consistently across skills that read loyalty tier data.
  • For B2B stores: combine with woo-b2b-customer-overview to exclude trade accounts from consumer tiers.

More skills from navarroido

woo-cancel-and-restock logo
navarroido/Woocommerce-skill

woo-cancel-and-restock

Cancel one or many WooCommerce orders and restore stock quantities for all line items with dry-run preview.

7 0
View
woo-loyalty-segment-export logo
navarroido/Woocommerce-skill

woo-loyalty-segment-export

Read-only: Export customers meeting spend or order-count thresholds for loyalty program enrollment.

7 0
View
woo-order-status-bulk-update logo
navarroido/Woocommerce-skill

woo-order-status-bulk-update

Move a filtered set of orders (by date, current status, or payment method) to a new status with dry-run preview.

7 0
View
woo-variant-attribute-normalizer logo
navarroido/Woocommerce-skill

woo-variant-attribute-normalizer

Read-only: Find product variations where attribute values are inconsistently cased or spelled, and export a normalization report.

7 0
View
woo-product-tag-bulk-update logo
navarroido/Woocommerce-skill

woo-product-tag-bulk-update

Add or remove tags from a filtered set of products (by category, price range, or stock status) with dry-run preview.

7 0
View
woo-low-stock-restock-alert logo
navarroido/Woocommerce-skill

woo-low-stock-restock-alert

Read-only: Query products below a configurable stock threshold and export a prioritized reorder sheet grouped by category.

7 0
View
woo-product-data-completeness-score logo
navarroido/Woocommerce-skill

woo-product-data-completeness-score

Read-only: Score each product against a required fields checklist (images, description, weight, SKU, attributes) and export a completeness gap report.

7 0
View
woo-fulfillment-status-digest logo
navarroido/Woocommerce-skill

woo-fulfillment-status-digest

Read-only: Aggregate order counts by status and flag orders overdue for processing based on a configurable SLA age threshold.

7 0
View
woo-bulk-order-notes logo
navarroido/Woocommerce-skill

woo-bulk-order-notes

Append a private or customer-visible note to multiple orders matching a status, date, or payment method filter.

7 0
View
woo-b2b-customer-overview logo
navarroido/Woocommerce-skill

woo-b2b-customer-overview

Read-only: Export customers with a B2B role or meta_data flag including order count, lifetime spend, and last order date.

7 0
View
woo-return-initiation logo
navarroido/Woocommerce-skill

woo-return-initiation

Update order status to returned/refunded and log a timestamped note with return reason.

7 0
View
woo-order-lookup-and-summary logo
navarroido/Woocommerce-skill

woo-order-lookup-and-summary

Read-only: Retrieve a WooCommerce order by ID or customer email and produce a human-readable support summary.

7 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View