Create order metafields with invoice details

When Sufio creates an invoice from an order, it can automatically add order metafields to the corresponding Shopify order. These metafields contain various details about the invoice.

This feature is useful in several ways. For example, other apps or extensions can read these metafields to use the invoice information in their workflows. You can also include these metafields when exporting orders from your store for analysis or reporting.

Note

Creation of order metafields is only available on the Premium plan and higher.

Enable creation of order metafields

To configure Sufio to automatically create order metafields with invoice details:

  1. In your Sufio account, go to the Settings → Documents page.
  2. Scroll down to the Advanced options section and expand Order metafields.
  3. Turn the Create order metafields with invoice details toggle on.
  4. Click on the Update settings button at the bottom of the page to save your changes.

By default, enabling this feature adds these two metafields to each order:

Note

When using the Multiple documents per order mode, Sufio only creates these order metafields for the first invoice of an order.

Customize the metafields template

You can customize which invoice properties are saved as metafields or even use fixed text values for metafields. For example, you might want to add a metafield for the invoice’s total amount in addition to the default ones.

To define custom metafields, enter the name and value for each metafield in the Order metafields template text field. Use the appropriate property, such as document.totals.total_incl_tax for the invoice total, or a fixed string as the value.

If you want to keep the default invoice_number and invoice_url metafields along with your custom ones, make sure to include them in this list as well.

For example, to create the default metafields and also include the invoice total and source, copy and paste the following snippet into the Order metafields template field:

{
"invoice_number": "{{ document.number }}",
"invoice_url": "{{ document.public_url }}",
"invoice_total": "{{ document.totals.total_incl_tax }}",
"invoice_source": "Sufio"
 }

Remember to click on the Update settings button to apply your changes.