# wc-product-copy: draft product copy from store data

[wc-product-copy](https://github.com/IndianOpinion/wc-product-copy) is a WordPress plugin for WooCommerce stores. It writes a description and a short description for each product from the store's own data, as drafts that an editor reads, edits and accepts. It is MIT licensed, and v0.1.0 was released on 18 November 2026.

It was written from scratch from an idea, as part of a set of utilities built between 11 and 19 November 2026 by language-model coding agents under the editor's direction. It has not run on a live store.

## The problem

A store with a few hundred products usually has many with an empty description. Writing them by hand is slow, so they stay empty. Empty pages look abandoned and give search engines nothing to index.

Pasting product data into a chat window is slow too, and it fails in known ways. The model invents a material, a size or a warranty. It states prices or delivery promises that are wrong a week later. A careless bulk script overwrites descriptions the owner wrote by hand. A loop with no cap spends money all night on retries. The output arrives as Markdown, or with scripts and links, and gets pasted into the page.

## What it does

- Builds a numbered fact list for each product and asks for copy that uses only those facts.

- Writes only to empty fields, or to fields holding text the plugin itself accepted earlier.

- Runs every bulk selection as a dry run first. The dry run makes no model call and writes nothing.

- Stores each result as a draft in post meta. The product does not change until an editor accepts.

- Flags numbers that are not in the facts, blocked phrases, price or stock talk, removed contact details, bad length and fact ids that do not exist.

- Offers undo after accept, while the field is unchanged.

- Provides wp product-copy commands, plus an admin settings page, a meta box and a drafts screen.

## How it works

The facts come from writer notes, brands, product type, category paths, attributes (term names, never slugs), weight and dimensions, tags and optionally codes. Prices, stock, shipping, tax, reviews, orders, customers, URLs and the current descriptions are never sent, even if a filter tries to add them.

Planner::evaluate() decides whether a product is eligible. The dry run and every queued job call the same method, so the two cannot drift apart. Each product is one job, keyed by its input hash, so pressing the button twice queues nothing new. Jobs run through gen-queue if it is active, otherwise through Action Scheduler.

A job reads the switch and caps afresh, locks the product, checks eligibility again, asks spend-meter if it is active, and makes one call through a ModelCaller seam. The built-in adapter uses llm-json-php and is text only. A site that wants the product image sent supplies its own caller through the product_copy_caller filter. The prompt is built in, or comes from a prompt-library template when that plugin is active.

At accept time the field is read again. If a person filled it in the meantime, accept is refused and the draft is shown for copying. Otherwise the text is cleaned a second time, saved through the WooCommerce product object, and its hash is stored so a later human edit is recognised. No custom tables are used.

wp product-copy generate --missing=any --dry-run
wp product-copy generate --missing=any --yes
wp product-copy drafts --state=pending
wp product-copy accept 123 --user=editor

## Guard rails

- The plugin is off after install. Nothing is sent anywhere until a model and key are set and generation is switched on.

- A daily call cap, 50 by default, counts attempts including billed failures. An optional daily cost cap needs an assumed cost per call. The constants for either can only lower the setting.

- Kill switch: wp product-copy pause, a button on the drafts screen, or a constant. A call already in flight finishes. No new call starts.

- There is no implicit "all". A command with no selection is an error.

- Product title and facts are sent inside <title> and <facts> blocks that the system text marks as data, with closing tags neutralised.

- Output is cleaned to simple HTML: no links, no scripts, no contact details.

- Every admin handler checks a nonce and a capability. The log holds no product text or keys.

## What review changed

- The companion contracts were wrong. Prompt-library's public names are promptlib_*, and the spend-meter intent key is est_input_tokens. A 200-character model name used to throw on init in gen-queue, and a null unit count threw after a draft had already been saved.

- Product title and facts were not fenced against prompt injection. They now are.

- Lock rows used a read, write, read-back sequence that could let two workers through. They now use a single INSERT IGNORE. The cap check and the attempt count were also joined into one locked step so counts are not lost.

- A field accepted from a draft could be accepted again from the same draft, overwriting its undo value with the plugin's own text. That is now refused.

- The meta box highlighted flagged numbers in escaped text, so a "3" could split an HTML entity. It now matches on raw text and escapes each piece.

## Limits and what is next

- The built-in adapter is text only. Sending the image needs your own caller.

- The drafts box is on the classic product editor. With the block editor, use Products > Copy drafts.

- Parent products only. Variation descriptions are not written.

- One language per site. No alt text, titles, SEO fields or translations.

- The fact check catches numbers and phrases, not every invented claim. A person reads every draft.

- Without a persistent object cache, the product lock is a transient with a read-back check, not an atomic lock.

- Acceptance and flag rates on a real catalogue are not measured. A dry run over 1,000 synthetic products took 1.1 seconds on the test stub layer, with no database.

There are no open issues. This is v0.1.0, tested on stubs and mocks. The test suite has 101 tests and 639 assertions, run against stubs and mocks, and static analysis and code style checks pass. CI has not yet run on GitHub.

## Install

Requires PHP 8.1 or later, WordPress 6.4 or later and WooCommerce 8.0 or later. The release zip bundles its one runtime dependency. From source:

cd wp-content/plugins
git clone https://github.com/IndianOpinion/wc-product-copy.git
cd wc-product-copy
composer install --no-dev --optimize-autoloader

[All 47 utilities](https://indianopinion.org/blog/open-source/) · [wc-product-copy on GitHub](https://github.com/IndianOpinion/wc-product-copy)

Canonical: https://indianopinion.org/blog/open-source/wc-product-copy/

AI disclosure: Every summary and comment here is written by AI and published automatically, without a person reviewing each article. We do no original reporting. How this works: https://indianopinion.org/ai-use-policy/
