Open jan-herman opened 6 months ago
Hi @jan-herman,
thanks for your question.
You are right. In multi-language sites such things as custom invoice numbers should always be stored in the default language. So I’m wondering why your approach of setting the languageCode in the update method doesn’t work.
Can you please double-check if the code
value stored in languages/cs.php
is cs
.
To make sure you always use the default language, you can do the following:
'ww.merx.completePayment:after' => function (OrderPage $orderPage) {
$customInvoiceNumber = 'Lorem Ipsum';
$orderPage->update([
'invoiceNumber' => $customInvoiceNumber,
], $orderPage->kirby()->defaultLanguage()?->code());
},
Hi, sorry for the late reply. For some reason I missed the notification.
Anyway cs
is definitely the default language code. All the other orders are saved as order.cs.txt
.
Hi there, I have a multi-language website (default language: czech, secondary: english) and I followed this cookbook recipe to add custom invoice numbers to orders: https://merx.wagnerwagner.de/cookbooks/custom-invoice-numbers.
In czech everything works as expected, but every time order is submitted in english, order.en.txt is created with following content:
While in order.cs.txt the Invoicenumber is missing.
I tried specifying locale like this, but that didn't work either.
Am I missing something or is this a bug related to #62?