One step ahead with these plugins

How to Auto-Assign Serial Numbers to WooCommerce Orders

Selling products that need serial numbers? Manually copying codes into order emails is slow, error-prone, and does not scale. This guide shows you how to auto-assign unique serial codes to every WooCommerce order — generated or pulled from a pre-loaded list.

The Problem With Manual Serial Assignment

If you sell software licenses, digital subscriptions, gift cards, or any product that needs a unique code delivered to the customer, you have probably been through this workflow: customer places an order, you open the order in WooCommerce, you look up an unused code from a spreadsheet, you paste it into the order notes or a custom email, and you mark the code as used in your spreadsheet.

This works when you sell five products a week. It breaks when you sell fifty. It is impossible at five hundred. And every manual step is a chance for error — sending the wrong code, reusing a code, or forgetting to send one at all.

Automated serial assignment eliminates all of these problems. When a customer completes a purchase, the system assigns a unique code automatically and includes it in the order confirmation email. No manual work, no spreadsheet, no mistakes.

How Automatic Serial Assignment Works

The Serial Codes Generator and Validator plugin integrates directly with WooCommerce to handle the full lifecycle:

  1. You create a code list and either pre-generate codes or let the system generate on demand
  2. You assign the code list to a WooCommerce product
  3. Customer purchases the product and payment is confirmed
  4. The plugin automatically assigns an unused code from the list (or generates a new one)
  5. The code appears in the order confirmation email, order details page, and optionally on PDF invoices

The entire process happens in the background without any admin intervention.

Setting It Up Step by Step

Step 1: Create a Code List

In the plugin admin, create a new code list. Give it a descriptive name like “Pro License Keys 2026” or “Gift Card Codes — March Batch”.

You have two options for populating it:

  • Pre-generate codes — generate a batch of codes upfront with your preferred format (length, character set, prefix, delimiter). Good when you want specific codes or need to print them on cards.
  • Generate on demand — the plugin creates a new code each time a product is sold. Good for digital products where the code format does not matter as long as it is unique.

Step 2: Configure the WooCommerce Product

Open the product you want to assign serial codes to. In the product data panel, you will find a section added by the plugin where you can:

  • Select the code list — choose which list this product pulls codes from
  • Set codes per item — how many codes each unit sold should receive (usually 1, but could be more for bundles)
  • Override format — optionally set a product-specific code format that differs from the list default

Step 3: Configure Display Options

In the plugin settings, decide where serial codes should appear:

  • Order confirmation email — the most important one; customers expect to receive their code immediately
  • Order details page — visible when the customer logs into their account
  • PDF invoice — if you use a WooCommerce PDF invoice plugin

You can also hide the CVV from emails or PDFs separately if you want to provide the security code through a different channel.

Reusing Pre-Loaded Codes vs. Generating New Ones

The plugin supports a “reuse” mode: when enabled, it first looks for an unused code in the assigned list before generating a new one. This is essential for scenarios where codes have already been printed on physical cards (like gift cards or scratch-off vouchers) — you need the digital code to match the physical one.

When reuse mode is off, the plugin always generates a fresh code, which is better for pure digital delivery where the code only needs to be unique, not pre-determined.

What Happens on Refunds and Cancellations

When a WooCommerce order is refunded or cancelled, the plugin can automatically free up the assigned code — removing the order association so the code can be reused for future orders. This prevents code waste and keeps your available inventory accurate.

You can enable or disable this behavior in the settings depending on whether code reuse after refund is appropriate for your business.

Working With Product Variations

For variable products — say a software license with Basic, Pro, and Enterprise tiers — each variation can pull from a different code list. The Basic variation might use 30-day trial codes while the Enterprise variation uses permanent license keys, each from their own pre-configured list.

The plugin handles this natively through WooCommerce variation support. Configure each variation independently in the product editor.

Use Cases for Auto-Assigned Serials

Software License Keys

Generate license keys on purchase and deliver them in the confirmation email. Customers activate the key in your software. The plugin tracks which keys are assigned and to which order.

Gift Cards and Voucher Codes

Pre-load a batch of gift card codes that match physical cards. When a customer buys a digital gift card, they receive the code immediately. When they buy a physical card, the code on the card is already in your system for later redemption.

Access Codes for Gated Content

Sell access to premium content, courses, or downloads by delivering a unique access code on purchase. Combine this with the validation shortcode so customers can enter their code on a gated page to unlock content.

Certificate of Authenticity

For handmade, limited edition, or luxury products, auto-assign a unique certificate number to each sale. Customers can verify the certificate on your website at any time.

Subscription Renewals

For WooCommerce Subscriptions, the premium version can reuse the same serial code across renewal orders — so a customer keeps their original license key when their subscription renews rather than receiving a new one each billing cycle.

Monitoring Your Serial Code Inventory

The admin panel shows you how many codes are available in each list, how many have been assigned, and how many are unused. This gives you a clear view of your “inventory” — when a list runs low, you can generate more codes before running out.

For products with pre-loaded codes (like printed gift cards), monitoring this is especially important. Running out of codes means orders cannot be fulfilled until you generate and load more.

Getting Started

Automating serial code assignment removes a tedious, error-prone step from your order fulfillment process. Whether you sell five licenses a week or five hundred, the system handles it identically — no manual work, no mistakes, no delays.

Install the free Serial Codes Generator and Validator plugin to test the WooCommerce integration on your site. The free version supports full auto-assignment with up to 500 codes.

Login