{"id":27684,"date":"2024-11-12T12:21:01","date_gmt":"2024-11-12T17:21:01","guid":{"rendered":"https:\/\/plumrocket.com\/docs\/?p=27684"},"modified":"2024-12-19T07:36:01","modified_gmt":"2024-12-19T12:36:01","slug":"variables-guide-for-creating-custom-number-patterns","status":"publish","type":"post","link":"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides\/variables","title":{"rendered":"Magento 2 Variables Guide for Custom Order Number Patterns"},"content":{"rendered":"\n<p>The <a href=\"\/magento-custom-order-number\">Magento 2 Custom Order Number<\/a> extension allows you to flexibly customize numbers for orders, sales notes, invoices, and more based on templates. This allows you to increase the visibility of documents, facilitates their administration and management, and ensures compliance with corporate standards or accounting requirements.<\/p>\n\n\n\n<p>Below is a complete list of variables that can be used to build templates, their descriptions, and examples of how to use them.<\/p>\n\n\n\n<h2 id=\"h-counter-variable\">Counter variable<\/h2>\n\n\n\n<p>The <strong>counter <\/strong>is used to gradually increase the numerical value with each new document in the system, which allows you to create consecutive numbers for convenient accounting.<\/p>\n\n\n\n<p>The format of the <code>{Ncounter}<\/code> variable, where <kbd><code>N<\/code><\/kbd> determines the number of digits in the counter, sets a fixed length of the numeric value. For example, <code>{6counter}<\/code> will create a counter of 6 digits (e.g., 000001, 000002) and <code>{4counter}<\/code> will create a counter of 4 digits (e.g., 0001, 0002). This ensures that the number format is consistent, even with a large number of documents.<\/p>\n\n\n\n<p><em><strong>Examples<\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-table\">\n    <table>\n        <tbody>\n        <tr>\n            <td>Template<\/td>\n            <td>The result example<\/td>\n        <\/tr>\n        <tr>\n            <td>ORD-{6counter}<\/td>\n            <td>ORD-000001, ORD-000002<\/td>\n        <\/tr>\n        <tr>\n            <td>INV-{4counter}<\/td>\n            <td>INV-0001, INV-0002<\/td>\n        <\/tr>\n        <tr>\n            <td>SHP-{4counter}<\/td>\n            <td>SHP-0001, SHP-0002<\/td>\n        <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<h2 id=\"h-date-information-variables\">Date information variables<\/h2>\n\n\n\n<p>Date variables allow you to automatically include information in the document number based on the date the document was created. This allows you to create unique numbers that contain the date, making it easier to identify and track documents. Date variables can be used in a variety of formats to represent the day, month, or year &#8211; both numeric and text values.<\/p>\n\n\n\n<p><em><strong>List of supported variables:<\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-table\">\n    <table>\n        <tbody>\n        <tr>\n            <td>Variable<\/td>\n            <td>Description<\/td>\n            <td>Example of values<\/td>\n        <\/tr>\n        <tr>\n            <td>{d}<\/td>\n            <td>Day of the month without leading zeros<\/td>\n            <td>1 to 31<\/td>\n        <\/tr>\n        <tr>\n            <td>{dd}<\/td>\n            <td>Day of the month, 2 digits with leading zeros<\/td>\n            <td>01 to 31<\/td>\n        <\/tr>\n        <tr>\n            <td>{m}<\/td>\n            <td>Numeric representation of a month, without leading zeros<\/td>\n            <td>1 through 12<\/td>\n        <\/tr>\n        <tr>\n            <td>{mm}<\/td>\n            <td>Numeric representation of a month, with leading zeros<\/td>\n            <td>01 through 12<\/td>\n        <\/tr>\n        <tr>\n            <td>{M}<\/td>\n            <td>A short textual representation of a month, three letters<\/td>\n            <td>JAN through DEC<\/td>\n        <\/tr>\n        <tr>\n            <td>{MM}<\/td>\n            <td>A full textual representation of a month, such as January or August<\/td>\n            <td>JANUARY through DECEMBER<\/td>\n        <\/tr>\n        <tr>\n            <td>{y}<\/td>\n            <td>A two digit representation of a year<\/td>\n            <td>99, 05<\/td>\n        <\/tr>\n        <tr>\n            <td>{yyyy}<\/td>\n            <td>A full numeric representation of a year, at least 4 digits<\/td>\n            <td>1999, 2005<\/td>\n        <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p><em><strong>Examples<\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-table\">\n    <table>\n        <tbody>\n        <tr>\n            <td>Template<\/td>\n            <td>The result example<\/td>\n        <\/tr>\n        <tr>\n            <td>ORD-{yyyy}-{m}-{dd}-{5counter}<\/td>\n            <td>ORD-2024-11-05-00001<\/td>\n        <\/tr>\n        <tr>\n            <td>ORD-{yyyy}-{m}-{d}-{4counter}<\/td>\n            <td>ORD-2024-11-5-0001<\/td>\n        <\/tr>\n        <tr>\n            <td>ORD-{yyyy}-{mm}-{dd}-{4counter}<\/td>\n            <td>ORD-2024-11-05-0001<\/td>\n        <\/tr>\n        <tr>\n            <td>ORD-{yy}-{mm}-{dd}-{5counter}<\/td>\n            <td>ORD-24-11-05-00001<\/td>\n        <\/tr>\n        <tr>\n            <td>ORD-{yy}-{M}-{d}-{6counter}<\/td>\n            <td>ORD-24-Nov-5-000001<\/td>\n        <\/tr>\n        <tr>\n            <td>ORD-{yyyy}-{MM}-{dd}-{4counter}<\/td>\n            <td>ORD-2024-Nov-05-0001<\/td>\n        <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<h2 id=\"h-store-information-variables\">Store information variables<\/h2>\n\n\n\n<p>When building templates, it is also possible to use store information, which allows you to create more personalized numbers for different stores in the system. This is especially useful if you have multiple stores in the system and need to identify which store a particular document clearly belongs to.<\/p>\n\n\n\n<p><em><strong>List of supported variables:<\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-table\">\n    <table>\n        <tbody>\n        <tr>\n            <td>Variable<\/td>\n            <td>Description<\/td>\n            <td>Example of values<\/td>\n        <\/tr>\n        <tr>\n            <td>{store_id}<\/td>\n            <td>A unique numerical identifier of the store in the system<\/td>\n            <td>1, 2<\/td>\n        <\/tr>\n        <tr>\n            <td>{store_code}<\/td>\n            <td>A unique store code used to identify a particular store in the system<\/td>\n            <td>default, french<\/td>\n        <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p><em><strong>Examples<\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-table\">\n    <table>\n        <tbody>\n        <tr>\n            <td>Template<\/td>\n            <td>The result example<\/td>\n        <\/tr>\n        <tr>\n            <td>ORD-{store_code}-{yy}-{mm}-{dd}-{5counter}<\/td>\n            <td>ORD-french-24-11-05-00001<\/td>\n        <\/tr>\n        <tr>\n            <td>ORD-{store_id}-{yyyy}-{MM}-{4counter}<\/td>\n            <td>ORD-1-2024-Nov-0001<\/td>\n        <\/tr>\n        <\/tbody>\n    <\/table>\n<\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Magento 2 Custom Order Number extension allows you to flexibly customize numbers for orders, sales notes, invoices, and more based on templates. This allows you to increase the visibility of documents, facilitates their administration and management, and ensures compliance with corporate standards or accounting requirements. Below is a complete list of variables that can &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides\/variables\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Magento 2 Variables Guide for Custom Order Number Patterns&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[399],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v17.2 (Yoast SEO v17.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Magento 2 Variables Guide for Custom Order Number Patterns - Plumrocket Documentation<\/title>\n<meta name=\"description\" content=\"The Magento 2 Custom Order Number extension allows you to flexibly customize numbers for orders, sales notes, invoices, and more based on templates. This\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides\/variables\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Magento 2 Variables Guide for Custom Order Number Patterns\" \/>\n<meta property=\"og:description\" content=\"The Magento 2 Custom Order Number extension allows you to flexibly customize numbers for orders, sales notes, invoices, and more based on templates. This\" \/>\n<meta property=\"og:url\" content=\"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides\/variables\" \/>\n<meta property=\"og:site_name\" content=\"Plumrocket Documentation\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-12T17:21:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-19T12:36:01+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Plumrocket\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Magento 2 Variables Guide for Custom Order Number Patterns - Plumrocket Documentation","description":"The Magento 2 Custom Order Number extension allows you to flexibly customize numbers for orders, sales notes, invoices, and more based on templates. This","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides\/variables","og_locale":"en_US","og_type":"article","og_title":"Magento 2 Variables Guide for Custom Order Number Patterns","og_description":"The Magento 2 Custom Order Number extension allows you to flexibly customize numbers for orders, sales notes, invoices, and more based on templates. This","og_url":"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides\/variables","og_site_name":"Plumrocket Documentation","article_published_time":"2024-11-12T17:21:01+00:00","article_modified_time":"2024-12-19T12:36:01+00:00","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Plumrocket","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/plumrocket.com\/docs\/#website","url":"https:\/\/plumrocket.com\/docs\/","name":"Plumrocket Documentation","description":"Extensions docs, troubleshootings etc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/plumrocket.com\/docs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides\/variables#webpage","url":"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides\/variables","name":"Magento 2 Variables Guide for Custom Order Number Patterns - Plumrocket Documentation","isPartOf":{"@id":"https:\/\/plumrocket.com\/docs\/#website"},"datePublished":"2024-11-12T17:21:01+00:00","dateModified":"2024-12-19T12:36:01+00:00","author":{"@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/c96fccdb89342ae6804272265723eca8"},"description":"The Magento 2 Custom Order Number extension allows you to flexibly customize numbers for orders, sales notes, invoices, and more based on templates. This","breadcrumb":{"@id":"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides\/variables#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides\/variables"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides\/variables#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Magento 2 Extensions","item":"https:\/\/plumrocket.com\/magento-extensions"},{"@type":"ListItem","position":2,"name":"Magento 2 Custom Order Number","item":"https:\/\/plumrocket.com\/magento-custom-order-number"},{"@type":"ListItem","position":3,"name":"Documentation","item":"https:\/\/plumrocket.com\/docs\/magento-custom-order-number"},{"@type":"ListItem","position":4,"name":"v1","item":"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1"},{"@type":"ListItem","position":5,"name":"How-to Guides","item":"https:\/\/plumrocket.com\/docs\/magento-custom-order-number\/v1\/userguides"},{"@type":"ListItem","position":6,"name":"Magento 2 Variables Guide for Custom Order Number Patterns"}]},{"@type":"Person","@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/c96fccdb89342ae6804272265723eca8","name":"Plumrocket","image":{"@type":"ImageObject","@id":"https:\/\/plumrocket.com\/docs\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/10c44aa45aab391250913d982e552e53?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/10c44aa45aab391250913d982e552e53?s=96&d=mm&r=g","caption":"Plumrocket"}}]}},"_links":{"self":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/27684"}],"collection":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/comments?post=27684"}],"version-history":[{"count":9,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/27684\/revisions"}],"predecessor-version":[{"id":27697,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/27684\/revisions\/27697"}],"wp:attachment":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/media?parent=27684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/categories?post=27684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/tags?post=27684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}