Custom Invoice Numbering — Documentation

Take control of invoice, delivery note, and credit slip numbering in PrestaShop with custom formats built from tags. Use clear document prefixes, date parts, padded counters, and reset rules that match your accounting workflow.

Features

  • Separate document formats. Define independent number patterns for invoices, delivery notes, and credit slips.
  • Tag-based format builder. Insert date, counter, order, customer, shop, product, payment, and random-reference tags into each document pattern.
  • Live format preview. Check the expected number format in the Back Office before saving it.
  • Independent document abbreviations. Use {DOC_TYPE} with different labels such as INV, DN, and CN.
  • Flexible counter padding. Choose counter width with tags such as {N}, {NNNN}, or {NNNNNN}.
  • Automatic counter resets. Reset each document type never, yearly, monthly, or daily.
  • One-time next number control. Set the next invoice, delivery note, or credit slip number when continuing from an existing accounting sequence.
  • Generated-number audit log. Review generated numbers with document type, order, counter value, pattern used, formatted number, and date.
  • Duplicate protection. The module refuses to reuse the same formatted number for the same document type.
  • PDF title and filename support. Invoice PDFs can use filesystem-safe formatted filenames, while delivery note and credit slip PDFs use installed overrides for formatted titles.
  • Multi-shop counters. Counters are stored per shop ID, so each shop can keep its own sequence values.
Custom Invoice Numbering — Admin invoice format builder Custom Invoice Numbering — Mprinvoicenumber integrity checks

Configuration options

  • Enable Custom Numbering. Turns custom numbering on or off; default: 1. Set it in Improve → Invoice Numbering → Settings.
  • Invoice Format. Controls the pattern used for invoice display numbers; default: {DOC_TYPE}/{YYYY}/{NNNNNN}. Set it in Invoice Format.
  • Delivery Format. Controls the pattern used for delivery note numbers; default: {DOC_TYPE}/{YYYY}/{NNNN}. Set it in Delivery Format.
  • Credit Slip Format. Controls the pattern used for credit slip numbers; default: {DOC_TYPE}/{YYYY}/{NNNN}. Set it in Credit Slip Format.
  • Invoice Abbreviation. Replaces {DOC_TYPE} in invoice patterns; default: INV.
  • Delivery Abbreviation. Replaces {DOC_TYPE} in delivery note patterns; default: DN.
  • Credit Slip Abbreviation. Replaces {DOC_TYPE} in credit slip patterns; default: CN.
  • Invoice Counter Reset. Decides when the invoice counter resets; default: yearly.
  • Delivery Counter Reset. Decides when the delivery note counter resets; default: yearly.
  • Credit Slip Counter Reset. Decides when the credit slip counter resets; default: yearly.
  • Invoice - Next Number. Sets the next invoice counter value once, then clears itself; default: ``.
  • Delivery - Next Number. Sets the next delivery note counter value once, then clears itself; default: ``.
  • Credit Slip - Next Number. Sets the next credit slip counter value once, then clears itself; default: ``.
Custom Invoice Numbering — Admin counter dashboard Custom Invoice Numbering — Mprinvoicenumber invoice format builder

Customization examples

Default installed configuration:

invoice_format = {DOC_TYPE}/{YYYY}/{NNNNNN}
delivery_format = {DOC_TYPE}/{YYYY}/{NNNN}
credit_slip_format = {DOC_TYPE}/{YYYY}/{NNNN}

invoice_doc_type_abbrev = INV
delivery_doc_type_abbrev = DN
credit_slip_doc_type_abbrev = CN

invoice_reset_mode = yearly
delivery_reset_mode = yearly
credit_slip_reset_mode = yearly

Common format patterns:

INV/{YYYY}/{NNNNNN}
INV-{YY}-{MM}-{NNNN}
{DOC_TYPE}/{YYYY}/{MM}/{NNNNN}
{DOC_TYPE}-{ORDER_ID}-{NNNN}
{DOC_TYPE}/{COUNTRY}/{YYYY}/{GLOBAL_NNNNNN}
{DOC_TYPE}/{CUSTOMER_REF}/{CUSTOMER_NNNN}

Available date and counter tags:

{YYYY} {YY} {MM} {DD} {QUARTER} {WEEK}
{N} {NN} {NNN} {NNNN} {NNNNN} {NNNNNN} {NNNNNNN} {NNNNNNNN}
{GLOBAL_N} {GLOBAL_NNNN} {GLOBAL_NNNNNN}
{CUSTOMER_N} {CUSTOMER_NNNN} {CUSTOMER_NNNNNN}

Useful context tags:

{DOC_TYPE} {ORDER_ID} {ORDER_REF} {INVOICE_ID} {SHOP_ID} {SHOP_NAME}
{CART_ID} {PAYMENT} {COUNTRY} {CUSTOMER_ID} {CUSTOMER_EMAIL} {CUSTOMER_REF}
{PRODUCT_ID} {PRODUCT_REF} {RAND4} {RAND2} {RAND6} {RAND7} {RAND8} {RAND9}

Lowercase aliases supported by the formatter:

{year} -> {YYYY}
{month} -> {MM}
{day} -> {DD}
{number} -> {N}
{counter} -> {N}
{reference} -> {CUSTOMER_REF}
{customer_reference} -> {CUSTOMER_REF}
{order_reference} -> {ORDER_REF}
{invoice_number} -> {N}
{global_number} -> {GLOBAL_N}
{global_counter} -> {GLOBAL_N}
{customer_number} -> {CUSTOMER_N}
{customer_counter} -> {CUSTOMER_N}
{secure_reference} -> {CUSTOMER_REF}
{product_reference} -> {PRODUCT_REF}

Valid reset patterns:

never:   {DOC_TYPE}/{NNNNNN}
yearly:  {DOC_TYPE}/{YYYY}/{NNNNNN}
monthly: {DOC_TYPE}/{YYYY}/{MM}/{NNNN}
daily:   {DOC_TYPE}/{YYYY}/{MM}/{DD}/{NNN}

Continue from an existing invoice sequence:

Invoice - Next Number = 1000
Invoice Format = {DOC_TYPE}/{YYYY}/{NNNNNN}

Next invoice: INV/2026/001000
Following invoice: INV/2026/001001

PDF override files installed by the module:

override/classes/order/Order.php
override/classes/pdf/HTMLTemplateDeliverySlip.php
override/classes/pdf/HTMLTemplateOrderSlip.php

Developer hook example for retrieving a formatted invoice number:

$formatted = Hook::exec('actionInvoiceNumberFormatted', [
    'order_invoice' => $orderInvoice,
]);
Custom Invoice Numbering — Admin number log Custom Invoice Numbering — Mprinvoicenumber override status

Installation

  1. In your PrestaShop Back Office, go to Modules → Module Manager.
  2. Click Upload a module.
  3. Select the module ZIP file.
  4. After installation, click Configure.
  5. Open Improve → Invoice Numbering to manage formats, counters, logs, and settings.
Custom Invoice Numbering — Admin numbering health

How it works

When PrestaShop creates a new document, the module reads the matching format, increments the needed counter, replaces tags with real order data, and stores the generated number in its log. Existing invoices, delivery notes, and credit slips are not rewritten.

In the Back Office, you get a dashboard with current counters and recent numbers, one format builder for each document type, a read-only generated-number log, and a settings screen with override status diagnostics.

Custom Invoice Numbering — Mprinvoicenumber counter settings

Honest limits

  • Existing document numbers stay as they are; the module applies your format only to new documents generated after configuration.
  • Invoice, delivery note, and credit slip counters are separate; there is no setting to make them share one sequence.
  • PrestaShop still keeps its native invoice number as a numeric value; the formatted invoice number is used for display through the invoice formatting hook and PDF handling.
  • Delivery note and credit slip PDF formatting depends on the module overrides being installed in the shop.
  • Format patterns must contain at least one counter tag and must stay within the module's 255-character generated preview limit.
  • {number:5} is not supported; use {NNNNN} for a five-digit counter.
  • If you use customer counters such as {CUSTOMER_NNNN}, include a unique customer or order tag such as {CUSTOMER_REF}, {CUSTOMER_ID}, or {ORDER_REF} to avoid duplicate-looking numbers.
Custom Invoice Numbering — Mprinvoicenumber dashboard counters

Frequently Asked Questions

Will this module change the numbers on invoices I have already issued?
No. Existing documents keep their previous numbers. The module generates formatted numbers for new documents after configuration.

Can I have the counter reset every year automatically?
Yes. Set the reset mode to yearly and include {YYYY} or {YY} in the pattern.

Can I reset by month?
Yes. Set the reset mode to monthly and use a pattern that includes both year and month, for example {DOC_TYPE}/{YYYY}/{MM}/{NNNN}.

Can I reset by day?
Yes. Set the reset mode to daily and include year, month, and day, for example {DOC_TYPE}/{YYYY}/{MM}/{DD}/{NNN}.

Can invoice, delivery note, and credit slip numbers use different formats?
Yes. Each document type has its own format, abbreviation, reset mode, and next-number setting.

Can delivery notes and invoices share the same sequence counter?
No. The module keeps separate counters for invoice, delivery, and credit_slip.

What happens if custom numbering is disabled?
PrestaShop native numbering is used while the module setting is off.

What happens if I enter an invalid format?
The module validates the pattern before saving and before generating a number. A valid format must contain at least one counter tag such as {N}, {NNNN}, or {NNNNNN}.

Compatibility: PrestaShop 1.6 to 9.0 (latest), PHP 7.1+. We continue to support upcoming PrestaShop versions.

Custom Invoice Numbering — Mprinvoicenumber generated numbers log
Loading...
Back to top