sap commerce cloud
How to Customize Order Number Format in SAP Commerce (Digits, Prefix, Alphanumeric)
In SAP Commerce Cloud, order numbers are not fixed—they are fully configurable. Businesses often require specific formats like prefixes, longer codes, or alphanumeric values. In this guide, you’ll learn how to customize order number format using configuration properties and simple extensions.
Apr 30, 2026•2 min read
1. Why Customize Order Numbers?
Default order codes in SAP Commerce look like:
00000001
00000002But real-world businesses often need:
- Country-based prefixes (e.g., U12345, I67890)
- Longer order numbers
- Alphanumeric formats
- Readable and meaningful identifiers
2. Key Configuration Properties
All customization starts with configuration properties.
Update these in:
hybris/config/local.propertiesImportant Properties
keygen.order.code.digits=8
keygen.order.code.start=00000000
keygen.order.code.type=numeric3. Customize Order Code Length (Digits)
To increase the length of order numbers:
keygen.order.code.digits=12Result:
000000000001
000000000002👉 Useful when:
- High order volume expected
- Need globally unique longer IDs
4. Change Starting Value
You can define where the sequence starts:
keygen.order.code.start=10000000Result:
10000000
10000001👉 Useful for:
- Migration scenarios
- Aligning with legacy systems
5. Use Alphanumeric Order Codes
To enable alphanumeric format:
keygen.order.code.type=alphanumericResult:
A0000001
A0000002👉 Useful for:
- More readable order IDs
- Business-specific formats
6. Adding Prefix to Order Numbers (Important)
SAP Commerce does not directly support prefixes via properties, but you can implement it using customization.
Example Requirement:
- US site →
U00000123 - IN site →
I00000456
Approach:
- Extend
PersistentKeyGenerator - Override
generate() - Append prefix based on site
Example output:
U000000123
I0000004567. Multi-Site Order Number Format (Real Use Case)
For multi-site setups:
SiteFormatUSU + 14 digitsINI + 16 digitsImplementation Idea:
- Define multiple key generators
- Use site-based logic in custom class
- Return correct format dynamically
We’ll cover this in detail in the next article.
8. Spring Bean Configuration
Order code customization is wired via Spring.
Example:
<bean id="orderCodeGenerator" class="de.hybris.platform.servicelayer.keygenerator.impl.PersistentKeyGenerator">
<property name="key" value="order_code"/>
<property name="digits" value="${keygen.order.code.digits}"/>
<property name="start" value="${keygen.order.code.start}"/>
<property name="type" value="${keygen.order.code.type}"/>
</bean>9. Common Mistakes to Avoid
❌ Changing project.properties
→ Will be lost during upgrade
❌ Not restarting server after config change
→ Changes won’t apply
❌ Expecting prefix via config only
→ Requires customization
10. Best Practices
- Always use
local.propertiesfor overrides - Keep order codes consistent across environments
- Avoid over-complicating format
- Use prefixes only when business requires
Conclusion
Customizing order number format in SAP Commerce Cloud is straightforward when you understand:
- Configuration properties
- Key generator behavior
- Where customization is required
This flexibility allows you to align technical implementation with real business needs.
What’s Next?
👉 Next: Multi-Site Order Code Generation in SAP Commerce (US vs IN Real Example)