Remove empty tokens during order number pattern generating

Created on 2 May 2024, 5 months ago
Updated 16 May 2024, 5 months ago

Describe your bug or feature request.

We set up a multi-store webshop. Each store would like to use different prefix for order number generating. We saw that on the UI we cannot set up number patterns per store, so we needed to use a different, token-based approach and we see that empty tokens are not cleared.

If a bug, provide steps to reproduce it from a clean install.

1. install commerce modules
2. /admin/commerce/config/store-types/online/edit/fields add a "Store prefix" text field to the store type
3. go to number patterns /admin/commerce/config/number-patterns/order_default/edit
4. set "Pattern" to [commerce_order:store_id:entity:field_store_prefix][pattern:number]
5. add a store and leave the "Store prefix" text field empty
6. create a payment gateway, a product,
7. add the product to cart
8. go through the checkout and submit the order, and now it displays this text:

Complete

Your order number is [commerce_order:store_id:entity:field_store_prefix]2.
You can view your order on your account page when logged in.

This is a weird order number for everyone. It seems empty tokens are not cleared from the original pattern string.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Number pattern

Created by

🇸🇰Slovakia kaszarobert

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024