wc-coupon-dynamic

wc-coupon-dynamic is a skill for Claude Code, Codex from Lonsdale201/wp-agent-skills. It costs 135 tokens per session (2,694 once invoked), scanned A, original, MIT.

A guide to virtual WooCommerce coupons: discount codes resolved at checkout from another source instead of stored as one database record per code. It covers how those codes are found and checked.

In plain words
What is it for?
Use it to connect namespaced discount codes to an entitlement system and support them in both classic checkout and the Store API.
Why use it?
It helps avoid unnecessary coupon records while making clear that the external resolver and usage ledger must handle validity, limits, and duplicate use.

Skill for Claude CodeCodex

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

Good fit Use it to connect namespaced discount codes to an entitlement system and support them in both classic checkout and the Store API.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lonsdale201/wp-agent-skills/wc-coupon-dynamic
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-coupon-dynamic
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-coupon-dynamic

README.md
[![agentmods](https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wc-coupon-dynamic/github.svg)](https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wc-coupon-dynamic)
Your own site
<a href="https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wc-coupon-dynamic"><img src="https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wc-coupon-dynamic/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-coupon-dynamic

Your own site · 80×15
<a href="https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wc-coupon-dynamic"><img src="https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wc-coupon-dynamic.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 135 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,694 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.00135 $0.02694
Opus 5 $0.00068 $0.01347
Sonnet 5 $0.00027 $0.00539
Haiku 4.5 $0.00014 $0.00269

Measured today against content hash 2bf2f58c674e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

wc-coupon-dynamic 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 today.

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-coupon-dynamic/SKILL.md · 240 lines

How it starts

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

WooCommerce virtual coupons

WooCommerce calls these virtual coupons. “Pseudo coupon” is an informal description, not the core term. Use one when a code is generated or resolved from another authoritative store and creating a shop_coupon post per code would cause unnecessary synchronization.

Choose the right model

Need Model
Merchant edits the code; core reporting, holds, and usage limits should work Persisted WC_Coupon; use wc-coupon-types-rules
A namespaced code maps to an external entitlement Virtual coupon from this skill
A new discount formula appears in the coupon type selector Register a complete custom type with wc-coupon-types-rules; it may also be used by a virtual coupon
A surcharge or positive adjustment WooCommerce fee API, not a negative coupon

A virtual coupon is not automatically safer or faster. Its resolver and usage ledger replace storage and concurrency behavior that core normally supplies.

Understand the resolution contract

WC_Coupon::__construct() filters the unresolved value before database lookup:

$coupon = apply_filters( 'woocommerce_get_shop_coupon_data', false, $data, $this );

A truthy result is passed to read_manual_coupon(), which sets ID 0, marks the object virtual, and skips persisted lookup. Returning false means “not resolved by this filter” and lets later filters or the database handle the input.

The input may be an integer ID or a string code. Do not type it as string. The filter can run on frontend, Store API, REST-adjacent order operations, admin, CLI, cron, and repeated calculation paths.

Use an owned namespace and one request snapshot

final class MyPlugin_Virtual_Coupons {
	private const PREFIX = 'loyalty-';

	/** @var array<string,object|null> */
	private static $entitlements = array();

	public static function normalize( $input ): ?string {
		if ( ! is_string( $input ) ) {
			return null;
		}

		$code = wc_strtolower( wc_format_coupon_code( $input ) );
		return 0 === strpos( $code, self::PREFIX ) ? $code : null;
	}

	public static function entitlement( string $code ) {
		if ( ! array_key_exists( $code, self::$entitlements ) ) {
			self::$entitlements[ $code ] = myplugin_find_entitlement( $code );
		}

		return self::$entitlements[ $code ];
	}

	public static function resolve( $resolved, $input ) {
		if ( false !== $resolved ) {
			return $resolved; // Preserve a resolver that ran earlier.
		}

		$code = self::normalize( $input );
		if ( null === $code ) {
			return false;
		}

		$entitlement = self::entitlement( $code );

		// Keep every owned-prefix code virtual, including denied/unknown ones.
		// Validation below rejects this inert marker without database fallback.
		if ( ! $entitlement ) {
			return array(
				'discount_type' => 'fixed_cart',
				'amount'        => '0',
				'description'   => __( 'Unavailable virtual coupon', 'myplugin' ),
			);
		}

		return array(
			'discount_type'       => 'percent',
			'amount'              => '10',
			'individual_use'      => true,
			'usage_limit'         => 1,
			'usage_count'         => (int) $entitlement->usage_count,
			'date_expires'        => $entitlement->expires_at,
			'exclude_sale_items'  => true,
			'description'         => __( 'Loyalty discount', 'myplugin' ),
		);
	}
}

add_filter(
	'woocommerce_get_shop_coupon_data',
	array( MyPlugin_Virtual_Coupons::class, 'resolve' ),
	10,
	2
);

Read the full file on GitHub · 240 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. today Changed · -1 lines 2bf2f58c674e
  2. 8d ago First seen · 241 lines · 135 tokens per session scan A c0728b3a6b78

Subscribe to this mod's changes

wc-coupon-dynamic is a skill published in the GitHub repository Lonsdale201/wp-agent-skills (22 stars, last pushed yesterday), licensed MIT. It adds 135 tokens to every session and 2,694 once invoked, about $0.0007 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