We will explain how you can create your own order or payment status and link it to an email template.
We recommend that you use Adminer to work on the database
Making a backup before you start is always a smart thing to do, just to be safe in case that things go wrong.
First we need to make sure that we use the right id's for the order and payment status that we are adding.
These id's are found in the database in the table state_machine.
Click on Select data (1) to see the entries.
Use the id found next to order_delivery.state (1) if you want to add an delivery status.
Use the id found next to order_transaction.state (2) if you want to add an payment status.
Use the id found next to order.state (3) if you want to add an order status.
We need the id DA86D74FE395431ABFB261723AEB5D14 to add the a payment status and id DC61061A3634414ABB584FD50B94BBD3 since we are adding order status.
Now that we have the id's that we need we can create the status, this is done in the table state_maschine_state.
With New item (1) you insert a new record into the table. This should bring up the following window.
If all entries are valid you should notice the message below.
Please note that you need the id's from both entries that you just created, in this case I created FA8C0650F5500FA89A33C2EF27D8D4B6 for the new payment status and AE3FDA7F48574C2797336515FC8D42C2 for the new order status.
Next you have to go to the table language to look-up the right language id's.
We will need to add the translations for English and German.
It's important that you check the id's that your system uses.
The English id is 2FBB5FE2E29A4D70AA5854CE7CE3E20B and the German is F4231401022B473285FE0BAAB078C46E.
Next you have to go to the table state_machine_state_translation to create the translations for your process.
Please note that you will need to do this for all languages that you are using, in this case I added English and German for both new status.
Since Shopware 6 specifies which status can be changed in which way and thus, for example, the status "open" cannot be changed directly to "completed", you must now also set this up for your new transaction.
I order to find the right id's open the table state_machine_state, In my example I will add my new oder status after the order status open so this is the id we want.
As you can see we have multiple entries (1) that are called open, to find the right one that matches the order process we can click on the state_machine_id (2).
Here we can see that the technical_name is order.state so this entry we need, go back to the last page and write down the id found in the column id, in this case it would be 1EEA2C93100C4770B561CA02FB195FF0.
To setup your new transaction, go to the table state_machine_transition and insert a new data record there.
After you have set up your new process as described above, it will be displayed in your selected category in the Admin and can be selected as you have previously configured.
The status is created, now you still have to create an email template for it.
Um die E-Mail_Vorlage zu erstellen, gehst Du auf Einstellungen > E-Mail-Templates > Erstellen.
Finally, you need to create an action for our new email template in the Flow Builder. To do this, go to Settings > Flow Builder > Add Flow.
Then add an action and select Send email as the action.
After you have saved the action, your process should be fully set up and selectable and functional in the Storefront and Admin.