← Blog

Bulk-Write WooCommerce Product Descriptions with Claude API

November 4, 2026 · AI Automation

If you run or build WooCommerce stores, you know the pattern. The catalog grows, new products get imported from a supplier spreadsheet, and the descriptions end up as one-line specs, copy-pasted manufacturer text, or nothing at all. That hurts both conversions and SEO.

AI can help a lot here, but only if you set it up properly. In this guide I’ll walk through a simple workflow for generating WooCommerce product descriptions in bulk with the Claude API: pull products from the WooCommerce REST API, ask Claude for a description, save the results for review, and only then push the approved copy back to the store. This is the same general approach behind the e-commerce AI content assistant I’ve been building for product descriptions and SEO.

Why Not Just Paste Products Into a Chatbot?

For five products, pasting into Claude or ChatGPT is fine. For 300 products, it breaks down fast:

  • You lose consistency in tone, length and structure across the catalog.
  • Copying text back and forth into the WordPress admin is slow and error-prone.
  • There’s no record of what was generated, when, or with which instructions.

A small script fixes all three. You write your brand rules once in a prompt, run it across the catalog, and keep everything in a reviewable file.

The Workflow at a Glance

  1. Fetch products that need copy from the WooCommerce REST API.
  2. Generate a long description and a short description with the Claude Messages API.
  3. Review the output in a CSV or spreadsheet. A human approves, edits or rejects each row.
  4. Publish only approved rows back to WooCommerce.

The review step is not optional. AI can invent features, materials or sizes that a product doesn’t have, and a wrong claim on a product page is a customer service (and possibly legal) problem.

Step 1: Set Up Your Keys

WooCommerce REST API keys

In WordPress, go to WooCommerce → Settings → Advanced → REST API and create a key. Use Read access for the fetch step, and a separate Read/Write key only when you’re ready to publish. Always call the API over HTTPS.

Claude API key

Create an API key in the Claude Console and store both sets of keys in environment variables, never in your code or Git repo:

export WC_URL="https://yourstore.com"
export WC_KEY="ck_xxxxxxxx"
export WC_SECRET="cs_xxxxxxxx"
export ANTHROPIC_API_KEY="sk-ant-xxxxxxxx"

Step 2: Fetch Products That Need Copy

The WooCommerce REST API returns products at /wp-json/wc/v3/products. Here’s a minimal PHP function using cURL:

function wc_get(string $path, array $query = []): array {
    $url = getenv('WC_URL') . '/wp-json/wc/v3/' . $path . '?' . http_build_query($query);
    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_USERPWD => getenv('WC_KEY') . ':' . getenv('WC_SECRET'),
    ]);
    $res = curl_exec($ch);
    curl_close($ch);
    return json_decode($res, true) ?? [];
}

// Example: published products in one category, 50 per page
$products = wc_get('products', ['category' => 15, 'per_page' => 50, 'status' => 'publish']);

Filter for products with an empty or very short description so you don’t overwrite copy someone already wrote by hand.

Step 3: Write a Prompt That Knows Your Store

The prompt is where most of the quality comes from. Give Claude clear rules and only the facts it’s allowed to use:

You write product descriptions for an online store.
Audience: small business owners in the Philippines.
Tone: friendly, clear, no hype. No exclamation marks.

Rules:
- Use ONLY the facts provided below. Do not invent materials,
  sizes, certifications or warranties.
- If an important detail is missing, write [CHECK: ...] instead.
- Long description: 120-180 words, 2 short paragraphs + a
  bullet list of key features, as simple HTML (p, ul, li).
- Short description: 1-2 sentences, under 160 characters.
- Return JSON: {"description": "...", "short_description": "..."}

Product facts:
{product name, category, attributes, existing text}

The [CHECK: ...] marker is a small trick that pays off: instead of guessing, the model flags gaps for your reviewer.

Step 4: Call the Claude Messages API

The Claude API uses a single endpoint, POST https://api.anthropic.com/v1/messages, with your key in the x-api-key header and an anthropic-version header:

function claude_generate(string $prompt): ?array {
    $payload = [
        'model' => 'YOUR_CLAUDE_MODEL_ID', // pick a current model from the docs
        'max_tokens' => 1024,
        'messages' => [['role' => 'user', 'content' => $prompt]],
    ];
    $ch = curl_init('https://api.anthropic.com/v1/messages');
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST => true,
        CURLOPT_HTTPHEADER => [
            'x-api-key: ' . getenv('ANTHROPIC_API_KEY'),
            'anthropic-version: 2023-06-01',
            'content-type: application/json',
        ],
        CURLOPT_POSTFIELDS => json_encode($payload),
    ]);
    $res = json_decode(curl_exec($ch), true);
    curl_close($ch);
    $text = $res['content'][0]['text'] ?? '';
    return json_decode($text, true); // null if the reply wasn't valid JSON
}

Model names change regularly, so check the models page in Anthropic’s documentation and choose one. For straightforward product copy, a smaller, cheaper model is often good enough. Test a few products on two models and compare before running the whole catalog.

Always handle failures: if the reply isn’t valid JSON or the API returns an error, log the product ID and move on instead of stopping the whole run.

Step 5: Save to a Review File, Not Straight to the Store

Write each result to a CSV with columns like id, name, description, short_description and approved:

$out = fopen('review.csv', 'w');
fputcsv($out, ['id', 'name', 'description', 'short_description', 'approved']);
foreach ($products as $p) {
    $copy = claude_generate(build_prompt($p));
    if (!$copy) { error_log("Failed: {$p['id']}"); continue; }
    fputcsv($out, [$p['id'], $p['name'], $copy['description'], $copy['short_description'], '']);
}
fclose($out);

Open the file in Google Sheets or Excel. Your reviewer fixes anything marked [CHECK: ...], edits the tone where needed, and types yes in the approved column.

Step 6: Push Approved Copy Back to WooCommerce

To update a product, send a PUT request to /wp-json/wc/v3/products/<id> with the fields you want to change:

{
  "description": "<p>Approved long description...</p>",
  "short_description": "Approved short description."
}

For bigger catalogs, WooCommerce also has a batch endpoint (/products/batch) that lets you update many products in one request. Run a test on a staging site first, and take a database backup before the first live run.

Keeping Costs and Quality Under Control

Cost

  • Start with one category, not the whole store.
  • For large, non-urgent jobs, look at Anthropic’s Message Batches API. It processes requests asynchronously at a lower price than standard calls, which fits overnight catalog jobs well.
  • Set a spend limit in the Claude Console so a bug in a loop can’t run up a surprise bill.

Quality and SEO

  • Avoid near-identical descriptions for product variants. Give the model the differences explicitly.
  • Don’t stuff keywords. Write for the shopper first. Search engines reward pages that are actually helpful.
  • Keep your prompt in version control so you know which rules produced which copy.

Where This Can Go Next

Once the basic loop works, it’s easy to extend: generate SEO meta titles and descriptions for your SEO plugin, translate copy for another market, or trigger the script from a cron job whenever new products are imported. You can also connect it to tools your team already uses, like a Trello card per batch for review, which is the same pattern I use in my Job Hunt Helper with Claude, Gmail and Trello.

Conclusion

AI won’t replace knowing your products, but it can remove most of the blank-page work. A small PHP script, a clear prompt with strict “facts only” rules, and a human review step give you consistent, store-ready copy without risking wrong claims on live pages. Start with ten products this week, compare the results with your current pages, and scale up only when you’re happy with the quality.

Sources