Search code examples
symfonyemaileventsshopware

Shopware5 order confirmation email event


After a long investigation, I am not able to find the correct event to use JUST before the order confirmation email is sent.

I need to add a value in the s_order_attributes table which will be included in the email template.

I tried many events (e.g. checkout) but they are all triggered after the email ones.

thanks !


Solution

  • Looking at the code when the email is sent I assume there are two events you can try. You can either try Shopware_Modules_Order_SendMail_FilterVariables or sOrder::sendMail::before. These are executed right before the sending. If the attributes are not loaded from the database anymore in that moment you can set the public variables in sOrder to change the values that get into the mail. This might help you out as well but I prefer the FilterVariables event as it gives you direct access to the variables.