Skip to main content

Metafields

In addition to syncing the ID verification status to the tags on the order and customer profile - Real ID also syncs metafields to the order and customer profiles on your Shopify store.

For example when an order requires ID verification, then Real ID will update the real_id.step to in_progress on the order. Then when the customer completes ID verification, the real_id.step metafield will be updated to completed.

You can use these metafields within your store's theme to conditionally show or hide elements based on the customer's verification status, or alter the customer experience entirely.

real_id.verified Metafield

This metafield is present on both the customer and order. It is a boolean type that will only be true if the ID check was passed or it was manually approved.

For example, you could use it to tell if the currently logged in customer is verified within a liquid template:


{% if customer %}
{% if customer.metafields.real_id.verified %}
You're verified! ✅
{% else %}
You're not verified ❌
{% endif %}
{% endif %}

real_id.step Metafield

This metafield is present on both the customer and the order. It is a short text field that can be one of three values:

  • in_progress - an ID check has not been completed yet
  • completed - the ID check has passed or been manually approved
  • failed - the ID check has failed or was manually rejected

Here's an example of displaying the customer's current ID verification status within a liquid template:


{% if customer %}
{% case customer.metafields.real_id.step %}
{% when 'in_progress' %} Please complete your ID check to continue
{% when 'failed' %} We were unable to verify your ID
{% when 'completed' %} You have passed ID verification
{% endcase %}
{% endif %}
note

This metafield will only be present on orders or customers that require ID verification.

If you have rules set up that only require ID verification on specific conditions, then these metafields will not be present on those orders.

real_id.check_id Metafield

This metafield is present on both the customer and the order. It is a short text field that contains the unique token that references the customer's most recent ID check.

Manually creating new ID checks will overwrite the real_id.check_id metafield. Please be careful when creating ID checks manually, if the customer is already verified then a new ID check will replace the current real_id.check_id metafield.

You can use this token as the ID parameter for retreiving the details of the ID check with the Real ID REST API.

note

This metafield will only be present on orders or customers that require ID verification.

If you have rules set up that only require ID verification on specific conditions, then these metafields will not be present on those orders.

Liquid Examples

Here are some examples to help with common uses of metafields.

Displaying a blur on images if the customer isn't logged in and verified

You can add a blur to all images on your site if the customer isn't logged in and verified using a condition on the real_id.verified metafield:

// styles.css.liquid

{% unless customer.metafields.real_id.verified %}
img {
filter: blur(1.5rem);
}
{% endunless %}

tip

You will need to use a .css.liquid or .scss.liquid file for this functionality. A normal CSS file will not be able to detect the currently logged in customer's metafields.

Display a call to action to verify if the customer isn't verified yet

You can conditionally show a call to action to login and verify if the customer isn't verified yet.


{% unless customer.metafields.real_id.verified %}

<div>
<h2>Verified account required</h2>
<p>
To continue with checkout, please login and verify your ID.
</p>
<p>
This process is instant and only needs to be done once.
</p>
<a href="/account/login">
<button>
Sign In
</button>
</a>
<div>

{% endunless %}

Creating a custom ID check prompt

For the most control, you can use our JS SDK to render an ID check prompt on any page and ID gate submission buttons or any elements in liquid.

Real ID will automatically load the current customer's ID check, but if you prefer to pass one created from the REST API, you can do so. Follow our example here.

Accessing Metafields with GraphQL

In addition to accessing ID verification metafields via the Liquid within your store's theme, you can access these fields through the Shopify Admin GraphQL.

Customer ID verification metafields

Here's an example query to retrieve the current ID verification related metafields with a GraphQL query:

query getCustomerDetails($customerId: ID!) {
customer(id: $customerId) {
firstName
lastName
email
phone
id
tags
metafields(first: 5, namespace: "real_id") {
nodes {
key
value
updatedAt
}
}
}
}

Order ID verification metafields

Here's an example query to retrieve the current ID verification related metafields with a GraphQL query:

query getOrderDetails($orderId: ID!) {
order(id: $orderId) {
id
tags
metafields(first: 5, namespace: "real_id") {
nodes {
key
value
updatedAt
}
}
}
}

ID verification before before checkout

If your store is requiring ID verification before checkout or before viewing store, then the metafields on the customer will be applied after they register or after they place an order and Shopify creates their customer profile.

tip

To use the ID verification metafields on your store's theme, we highly recommend you prompt customers to login. Without the customer logging in, your theme won't be able to access the customer's current ID verifications status through metafields.