Shopware Flow Builder: Automate Document Creation & Email Sending

Automating Document Generation and Email Sending in Shopware 6: A Flow Builder Guide

Shopware's Flow Builder is a powerful tool for automating various processes within your online store. However, users often encounter specific challenges when trying to implement highly customized workflows. One such common query, as highlighted in a recent Shopware forum discussion, revolves around triggering actions after a document (like an invoice or delivery note) has been created.

The Challenge: No 'Document Created' Trigger

The initial question from a user, frip-tech.de, was straightforward: "Ich erstelle ein Dokument, kann ich automatisch einen Flow mit eigenem Mailtemplate auslösen?" (I create a document, can I automatically trigger a Flow with my own email template?). This points to a desire to use the act of document creation itself as the starting point for an automated sequence, specifically to send a custom email.

As expert aldo_quantic clarified, the Shopware Flow Builder does not, by default, offer a "Document Created" trigger. This means you cannot directly initiate a flow after a document has been manually or automatically generated if the generation itself is the sole trigger.

The Solution: Reversing the Flow Logic

The key insight provided by aldo_quantic is to "reverse the order" of operations. Instead of the document triggering the flow, the flow should be configured to generate the document itself as part of its sequence. This approach leverages existing triggers and actions within the Flow Builder to achieve the desired outcome.

Step-by-Step Implementation in Shopware Flow Builder

To implement this workaround, follow these steps:

  • Choose an Appropriate Trigger: Instead of waiting for a document to be created, select a relevant order status change as your Flow's starting point. Common examples include:
    • "Order status changed to 'Paid'" (for invoices)
    • "Delivery status changed to 'Shipped'" (for delivery notes)
    This ensures that the automation kicks in at a logical point in your order fulfillment process.
  • Add the 'Generate Document' Action: Once your trigger is set, add the "Generate Document" action to your Flow. Here, you can specify the type of document you want to create (e.g., Invoice, Delivery Note, Credit Note).
  • Add the 'Send Email' Action: Immediately after the "Generate Document" action, add the "Send Email" action. This is where you can select your custom email template.
  • Attach the Document: Crucially, within the "Send Email" action, you will find an option to attach documents. Select the document type you just generated (e.g., "Rechnung" for invoice, "Lieferschein" for delivery note).
  • Ensure Correct Action Order: The sequence of actions is vital. The "Generate Document" action must precede the "Send Email" action. If the document isn't generated first, it won't be available to attach to the email.

Important Limitation: Manual Document Creation

It's important to note a significant limitation of this method: "Wenn du Dokumente manuell im Admin erstellst, läuft darüber allerdings kein Flow." (However, if you manually create documents in the admin, no Flow will run through this.) This means the automation only applies to documents generated by the Flow itself. If your team manually creates an invoice in the Shopware admin, the associated email with your custom template will not be automatically sent via this Flow.

Conclusion for Shopware Merchants and Developers

While the absence of a direct "Document Created" trigger might seem like a hurdle, Shopware's Flow Builder offers a robust workaround. By understanding and reversing the logic – making the Flow responsible for document generation – you can effectively automate the process of creating documents and sending customized emails. This approach is a testament to the flexibility of the Flow Builder, allowing merchants and developers to design sophisticated workflows that enhance efficiency and customer communication within their Shopware stores.

For more insights into optimizing your Shopware store or planning a migration, visit Migrate My Store, your Shopware Migration Hub.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools