How to sell digital codes in WooCommerce
WooCommerce can deliver a digital file after payment, but it does not assign, track or validate a unique code for each order. For a small manual shop you can send codes yourself; for automatic delivery, expiry and activation, use a serial-number plugin.
- 01Choose the delivery method
- 02Create the digital product
- 03Use the manual route carefully
- 04Check access after payment
- 05Automate unique code delivery
- 06Test the failure cases
What you need
- A WooCommerce store on WordPress 6.0 or later
- Admin access to WordPress
- A payment gateway that confirms completed payments
- A stock of valid digital codes or licence keys
Choose the delivery method
Decide whether every customer receives the same file or whether each order must receive one unused code. A PDF, text file or download can be handled by WooCommerce itself. Unique licence keys, game codes and gift codes need code allocation and stock tracking in addition to file delivery.
WooCommerce's built-in downloadable product settings cover files, download limits and download expiry, but not serial-number assignment, activation or validation.
Create the digital product
Go to Products > Add new, add the product name, description and price, then tick Virtual so WooCommerce does not ask for shipping details. Tick Downloadable if you are delivering a file, then add the file customers should receive.
Set an optional download limit and expiry period. A product that is both virtual and downloadable can move directly to Completed after successful payment.
Use the manual route carefully
For a handful of orders, you can keep a private spreadsheet of unused codes, check the payment, copy one code into the order notes or a customer email, and mark that code as used. This is acceptable for low volume when a person is available to fulfil every order.
Do not upload a list of unused codes as one downloadable file. Every buyer could receive the whole list, and WooCommerce will not know which individual code has been redeemed. Manual fulfilment also gives you no automatic stock warning, expiry enforcement or activation check.
Check access after payment
Review WooCommerce > Settings > Products > Downloadable products and decide whether to grant access after payment or only when the order reaches Completed. If access is granted after payment, customers can receive downloads from the order received page, order email or My Account > Downloads.
Place a real or test order and check the thank-you page, customer email and account area. If nothing is delivered, first check that the product is downloadable, the file exists and the payment has reached the required order status.
Automate unique code delivery
For automatic assignment, install the free WC Serial Numbers plugin and its Pro extension, then create or import your code inventory and connect it to the relevant WooCommerce product. Configure whether codes are assigned automatically after payment and where customers can see them.
WC Serial Numbers Pro is suited to licence keys, serial numbers, gift codes and access codes because it can assign and deliver codes, track inventory, apply expiry and activation rules, and expose validation tools. This is the fast route when customers must receive one unused code without manual work.
Test the failure cases
Test a successful paid order, a failed payment, a cancelled order, a refunded order and an order with more than one quantity. Confirm that a code is not assigned before payment, that one code is not issued twice, and that the customer can find the code in the intended email, order page or account area.
Also test low stock, expired codes and invalid activation attempts. Mixed physical and digital orders need extra care: granting a digital code after payment does not mean the physical part of the order has shipped.
Let WC Serial Numbers Pro do it
Automatically assigns, delivers, expires and validates licence keys, serial numbers and gift codes after purchase.
Sources
- woocommerce.com /document/managing-products/virtual-downloadable/?utm_source…
- woocommerce.com /document/digital-downloadable-product-handling/?utm_source=…
- woocommerce.com /document/managing-orders/order-statuses/?utm_source=openai
- woocommerce.com /document/completed-order-email-doesnt-contain-download-link…
Questions
- Can WooCommerce generate a unique code for every order?
- No, WooCommerce core delivers downloadable files but does not provide a complete unique-code allocation and validation system. You can create a manual process with a private code list, but you must assign and mark each code yourself. For automatic allocation, stock control, expiry and activation, add a serial-number or digital-code extension.
- How do customers receive a digital code?
- Customers receive a code through the order confirmation flow configured by your code-delivery system. A standard WooCommerce downloadable product can show a file link on the order received page, in the order email and under My Account > Downloads when access is permitted. A serial-number extension can place the actual assigned code in those locations instead of delivering one shared file.
- Should a digital code product be virtual and downloadable?
- Yes, use Virtual when the product needs no shipping, and use Downloadable when WooCommerce is delivering a file. Products marked both ways can skip Processing and move to Completed after payment. If you are delivering a unique code through an extension rather than a file, follow that extension's fulfilment settings and still prevent shipping fields where appropriate.
- How do I stop customers receiving codes before payment?
- Only assign or reveal a code after the payment gateway confirms payment. For standard downloads, review the Grant access to downloadable products after payment setting; if it is disabled, access normally waits for Completed status. Never fulfil Pending payment, Failed, Cancelled or unpaid On hold orders just because an order was created.
- Can I sell digital codes alongside physical products?
- Yes, but mixed orders need a separate fulfilment check. A digital code can be released after confirmed payment while the physical item remains in Processing until shipped. Do not change the whole order to Completed merely to release a code if that status is also used by shipping integrations to indicate that the parcel has been fulfilled.