wc-customer-and-sessions

wc-customer-and-sessions is a skill for Claude Code, Codex from Lonsdale201/wp-agent-skills. It costs 108 tokens per session (2,226 once invoked), scanned A, original, MIT.

A guide to WooCommerce shopper accounts and sessions. A session holds temporary cart and checkout state, while a customer account stores lasting profile data.

In plain words
What is it for?
Use it when reading or updating the active shopper, guest sessions, logged-in customer profiles, cart tokens, or verified guest-order links.
Why use it?
It prevents temporary checkout values from being mistaken for permanent account fields, and helps avoid exposing private user metadata in APIs or exports.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when reading or updating the active shopper, guest sessions, logged-in customer profiles, cart tokens, or verified guest-order links.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lonsdale201/wp-agent-skills/wc-customer-and-sessions
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Lonsdale201/wp-agent-skills --skill wc-customer-and-sessions
Clone the repo
git clone --depth 1 https://github.com/Lonsdale201/wp-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wc-customer-and-sessions

README.md
[![agentmods](https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wc-customer-and-sessions/github.svg)](https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wc-customer-and-sessions)
Your own site
<a href="https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wc-customer-and-sessions"><img src="https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wc-customer-and-sessions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for wc-customer-and-sessions

Your own site · 80×15
<a href="https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wc-customer-and-sessions"><img src="https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wc-customer-and-sessions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 108 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,226 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00108 $0.02226
Opus 5 $0.00054 $0.01113
Sonnet 5 $0.00022 $0.00445
Haiku 4.5 $0.00011 $0.00223

Measured yesterday against content hash f9b82476abce, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

wc-customer-and-sessions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

woocommerce/wc-customer-and-sessions/SKILL.md · 219 lines

How it starts

The opening of the file, as written. The whole thing — 219 lines — stays where its author put it; the contents beside it link to each section on GitHub.

WooCommerce customers and sessions

Use this skill whenever code touches the active shopper, account profile, cart-flow state, or Store API session.

The critical distinction

WC()->customer is created in session mode:

new WC_Customer( get_current_user_id(), true );

Its data store is WC_Customer_Data_Store_Session. Calling WC()->customer->save() updates the WooCommerce session for both guests and logged-in users; it does not persist account fields to user meta.

To edit a registered customer's durable profile, load a separate non-session object:

$customer = new WC_Customer( $user_id );
$customer->set_billing_phone( $phone );
$customer->save();

Never use the active session object as a shortcut for an account-profile write.

WC_Customer::get_meta_data() is not a safe way to publish a user's entire metadata bag. WooCommerce filters its own customer model's internal/account-preference keys (WooCommerce 11.0 also excludes WordPress's infinite_scrolling preference), but arbitrary third-party user meta can still be private. REST responses, exports, and headless profiles should use an explicit allowlist of extension-owned keys rather than forwarding customer meta wholesale.

Initialization boundaries

On normal cart and checkout requests WooCommerce initializes WC()->session, WC()->customer, and WC()->cart. They are not guaranteed in early hooks, WP-CLI, cron, arbitrary REST routes, or admin requests.

add_action( 'wp_loaded', static function (): void {
    if ( ! function_exists( 'WC' ) || ! WC()->session ) {
        return;
    }

    $campaign = WC()->session->get( 'myplugin_campaign', '' );
} );

Do not call WC()->initialize_cart() globally just to make a property non-null. Initialize cart/session state only in a request that genuinely needs shopper state.

Store plugin state in the session

add_action( 'wp_loaded', static function (): void {
    if ( ! WC()->session ) {
        return;
    }

    WC()->session->set(
        'myplugin_quote',
        array(
            'product_id' => absint( $_POST['product_id'] ?? 0 ),
            'quantity'   => max( 1, absint( $_POST['quantity'] ?? 1 ) ),
        )
    );

    // Must happen before headers are sent. set() marks data dirty; the DB row
    // is written later by save_data(), normally during shutdown.
    WC()->session->set_customer_session_cookie( true );
} );

Read the full file on GitHub · 219 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday Changed · -2 lines f9b82476abce
  2. 9d ago First seen · 221 lines · 108 tokens per session scan A e106d81d1878

Subscribe to this mod's changes

wc-customer-and-sessions is a skill published in the GitHub repository Lonsdale201/wp-agent-skills (22 stars, last pushed 2d ago), licensed MIT. It adds 108 tokens to every session and 2,226 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

commerce-app-business-config

Manage custom business configuration in an Adobe Commerce app. Use when the user wants to add, modify, or remove merchant-configurable settings (config fields, admin config, store configuration) exposed through Commerce Admin. Creates typed config fields (text, password, email, url, tel, boolean, list) in…

adobe/skills · 80 tokens

doku-payment-gateway

Expert guide for integrating DOKU Payment Gateway (Jokul API v2). Covers HMAC-SHA256 header signature calculation, Checkout & Direct APIs (VA, QRIS, E-Wallet, Credit Card), webhook notification verification, and sandbox/production setup / Panduan ahli integrasi DOKU Payment Gateway.

roedyrustam/vibes-plug · 71 tokens

webhook-integration

Complete guide for setting up and handling Dodo Payments webhooks for real-time payment event notifications.

dodopayments/skills · 24 tokens

better-auth-integration

Guide only for applications using @dodopayments/better-auth, covering authenticated customer sync, checkout, portal access, usage ingestion, and verified webhook callbacks.

dodopayments/skills · 37 tokens

newebpay-checkout

A checkout integration for NewebPay’s MPG payment service, which provides an online payment page. It includes encrypted payment data, an HTML form submission, and callback endpoints for payment results.

paid-tw/skills · 48 tokens

kryptogo-pay-webhook

A callback endpoint for KryptoGO Payment, which sends your application updates about a payment. It handles pending, successful, expired, insufficient, and refunded outcomes.

paid-tw/skills · 47 tokens