WC Payment Code

Unique Payment Code Generator for WooCommerce
Version: 1.1.8 • Release date: September 16, 2025 • Author: Labs by webside.id

Introduction

WC Payment Code adds a unique payment code to every WooCommerce order. It streamlines manual/bank transfer reconciliation and reduces input mistakes.

  • Flexible strategies (incremental / random) with start/max and daily reset
  • Gateway filtering, email/thank-you output
  • Admin reports & CSV export (as in v1.1.7)
  • New: optional Code Prefix & Code Suffix for display only
  • Translation-ready (textdomain loaded on init)
Note: In v1.1.8 (Restored), the numeric code is still used for calculations/fees. Prefix/Suffix only modifies display in Thank You & emails.

Requirements

SoftwareMinimumRecommended
WordPress6.06.7+
WooCommerce7.08.5+
PHP7.48.1+
DatabaseMySQL 5.7 / MariaDB 10.3MySQL 8+ / MariaDB 10.6+

Installation

  1. Upload wc-payment-code.zip via Plugins → Add New → Upload Plugin.
  2. Activate the plugin.
  3. Go to WooCommerce → Settings → Payment Code to configure.

Quick Start

  1. Ensure Enable Payment Code is on.
  2. Choose your strategy (incremental/random), set start/max and daily reset if needed.
  3. Optional: set Code Prefix/Code Suffix for display (e.g., INV-, -ID).
  4. The code is automatically shown on the Thank You page and in emails (if enabled). Use the shortcode only if you want to display it elsewhere (e.g., custom page, My Account dashboard):
[wcpc_payment_code]

Settings

OptionDescription
Enable Payment CodeGlobally enables/disables the generator and display.
StrategyIncremental or Random, with Start Code & Max Code controls.
Daily ResetResets numbering daily (for supported strategies).
Only For Selected GatewaysRestrict generation to specific payment gateways.
Apply when Subtotal = 0Generate the code even when subtotal equals zero.
Fee TitleTitle used for the unique-code fee line (if you apply it).
Show in EmailsInclude the code in WooCommerce emails.
Code PrefixText before the numeric code for display (e.g., INV-).
Code SuffixText after the numeric code for display (e.g., -ID).
CSV Export / ReportsExport or review codes from the admin Reports page.

Shortcodes

[wcpc_payment_code]

The payment code is automatically added to the Thank You page and WooCommerce emails (if enabled).
Use this shortcode only if you want to display the code elsewhere (custom page, My Account, Elementor block, etc.).

[wcpc_payment_code label="Payment Code:" fallback="—"]
On pages without an order context, the shortcode will render the fallback value.

Order Meta Keys

  • _wcpc_code — numeric value (used for fee/calculations and primary reconciliation).
  • _wcpc_code_display — display string (Prefix + numeric + Suffix) for Thank You & emails.

Reports

Navigate to WooCommerce → Payment Code → Reports to view the summary (as in v1.1.7) and export CSV where available.

Hooks & Filters

Actions

do_action( 'wcpc/code_generated', string $code, int $order_id );

Filters

  • apply_filters( 'wcpc/code_length', int $length ) — override random length (settings take precedence when present).
  • apply_filters( 'wcpc/charset', array $chars ) — customize random character set.
  • apply_filters( 'wcpc/code_format', string $display, int $order_id ) — modify the final display string.

Troubleshooting

Notice “translation loaded too early”

This plugin loads its textdomain on init. If the notice originates from another plugin, it is not an error in WC Payment Code.

Code not showing on Thank You

  • Verify the plugin is active and the gateway matches “Only For Selected Gateways”.
  • Ensure the page has an order context, or enable “Show in Emails” for email output.

FAQ

Is Prefix/Suffix mandatory?
No. It’s purely for readability and filtering in bank statements. The numeric code remains the basis for calculations.

Theme/plugin compatibility?
Yes. The plugin doesn’t alter WooCommerce core and relies on standard hooks/filters.

Changelog

1.1.8 — 2025-09-16
- Restored all v1.1.7 features (settings, reports, email output)
- New: Code Prefix & Suffix (display only), meta `_wcpc_code_display`
- Fix: Helper Settings::get() to avoid fatals in legacy calls
- Dev: load_plugin_textdomain on `init` (WP 6.7+)

1.1.7 — 2025-09-15
- Stabilization: reports & settings, initial CodeCanyon docs

1.1.6 — 2025-09-10
- CSV Export, [wcpc_payment_code] shortcode, settings polish

Support

Includes 6 months of Envato support. Please provide WP/WC/PHP versions, error logs, and reproduction steps when opening a ticket.

License

Distributed under Envato Market license.

© 2025 Labs by webside.id — Documentation v1.1.8