Just like with your invoices, you can have your invoice corrections created automatically using the Flow Builder. In this article, we explain how this works. You can find general information and tips on the Flow Builder here.
Add automatic invoice correction creation to the flow
Of the Pickware-specific triggers in the Flow Builder, two triggers are relevant in this case:
Pickware → Return → Fully returned
Pickware → Return → Partially returned
Attention: Keep only one flow active per trigger that creates invoice corrections.
Note: An invoice correction is only created if an invoice already exists for the order.
Since it is not possible to combine both triggers in one flow, we need two separate flows here, which are identical apart from the trigger. Create the flows as follows:
Go to Settings → Shop → Flow Builder and click Add flow at the top.
Enter a name and optionally a description. Activate the flow using the checkbox at the bottom.
Next, switch to the Flow tab and select the trigger Fully returned or Partially returned.
Add a new action below it. You can find the action you need under General → Generate documents. Then select the type Invoice correction as the document to be created, as well as the warehouse the document should refer to. Click Add action.
Save the flow using the button at the top right.
Now repeat the steps above to create the second flow. Select the other trigger and adjust the name and description of the flow to make it easier to tell them apart.
Note: If you send the invoice correction by email in the same flow, the action for sending must come after the action for creating the invoice correction.
If no invoice correction should be created for certain orders, for example for an exchange via easyReturns, mark these orders with a tag and exclude them in the flow. You can find more on this in How do I use easyReturns with Pickware for Shopify?
Send invoice corrections to your customers by email
Just like sending invoices by email, you can also send your invoice corrections to your customers automatically by email by customizing the corresponding email template. The customer can then download the invoice correction via a button within the email.
To customize the template, navigate in your Shopify Admin to Settings → Notifications → Customer notifications → Order exceptions. Click the entry Refund for order there and then click Edit code at the top right.
Look for the following spot in the code. It should be located relatively far down in the email template.
At the spot marked with the red line, insert the following code:
{% if metafields.pickware.pickware_invoice_correction_urls %}
<table>
{% for url in metafields.pickware.pickware_invoice_correction_urls -%}
<tr>
<td class="actions__cell">
<table class="button main-action-cell" style="width: 100%; margin-top: 12px;">
<tbody>
<tr>
<td class="button__cell">
<a href="{{ url }}" class="button__text">
{{ forloop.index }}. Rechnungskorrektur herunterladen
</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
{% endfor %}
</table>
{% endif %}Now save your change using the button at the top.
The change to the template means that for returns with an invoice correction, the email displays a button that leads to the corresponding invoice correction. If there is no invoice correction, the button is not displayed. For this reason, the preview function within the template settings does not display the button either. To see an actual preview, you need to create a test order, ship it, and then return it.
