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)
Requirements
| Software | Minimum | Recommended |
|---|---|---|
| WordPress | 6.0 | 6.7+ |
| WooCommerce | 7.0 | 8.5+ |
| PHP | 7.4 | 8.1+ |
| Database | MySQL 5.7 / MariaDB 10.3 | MySQL 8+ / MariaDB 10.6+ |
Installation
- Upload wc-payment-code.zip via Plugins → Add New → Upload Plugin.
- Activate the plugin.
- Go to WooCommerce → Settings → Payment Code to configure.
Quick Start
- Ensure Enable Payment Code is on.
- Choose your strategy (incremental/random), set start/max and daily reset if needed.
- Optional: set Code Prefix/Code Suffix for display (e.g.,
INV-,-ID). - 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
| Option | Description |
|---|---|
| Enable Payment Code | Globally enables/disables the generator and display. |
| Strategy | Incremental or Random, with Start Code & Max Code controls. |
| Daily Reset | Resets numbering daily (for supported strategies). |
| Only For Selected Gateways | Restrict generation to specific payment gateways. |
| Apply when Subtotal = 0 | Generate the code even when subtotal equals zero. |
| Fee Title | Title used for the unique-code fee line (if you apply it). |
| Show in Emails | Include the code in WooCommerce emails. |
| Code Prefix | Text before the numeric code for display (e.g., INV-). |
| Code Suffix | Text after the numeric code for display (e.g., -ID). |
| CSV Export / Reports | Export 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="—"]
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.