# Create order metafields with invoice details

> Learn how to create Shopify order metafields with invoice details in Sufio for automations, integrations, and reporting.

When Sufio creates an invoice from an order, it can automatically add order metafields to the corresponding Shopify order. These metafields store invoice details directly on the order.

Sufio, an invoicing app for Shopify, lets you use these metafields in automations, integrations, and reporting workflows.

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

## 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 on the **Create order metafields with invoice details** toggle.
4. Click the **Update settings** button at the bottom of the page to save your changes.

By default, enabling this feature adds the following metafields to each order:

- `invoice_number`: The invoice number (the value of `document.number`).
- `invoice_url`: A public link to the invoice (`document.public_url`). This metafield only contains a value if online documents are enabled in Sufio.

Sufio creates the metafields in the `sufio` namespace. For example, the invoice number is saved as `sufio.invoice_number`.

Sufio writes the metafields once, when it creates the invoice. If the invoice changes later, the metafields aren’t updated.

![Enable creation of order metafields](<https://sufio.com/content/media/images/Image%5Fpleine%5Flargeur%5F1-720w.webp>)

> **Note**
>
> When using the [multiple documents per order](<https://sufio.com/articles/shopify/create-documents-orders/document-creation-modes/>) mode, Sufio creates order metafields only for the first invoice created for the order.

## Customize the metafields template

You can customize which invoice properties are saved as order metafields and also use static text values. For example, you might want to save the invoice total in addition to the default metafields.

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

Each name in the template becomes the key of a metafield in the `sufio` namespace. Names must be at least two characters long.

If you want to keep the default `invoice_number` and `invoice_url` metafields alongside your custom ones, make sure to include them in the template 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:

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

Click the Update settings button to apply your changes.

> **Plan-specific feature**
>
> Creation of order metafields is only available on the [**Premium** plan and higher](<https://sufio.com/articles/shopify/billing/sufio-plans/>).
