> ## Documentation Index
> Fetch the complete documentation index at: https://reportana.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# find_orders_by_email

### Introduction

The `find_orders_by_email` function is used to search for orders based on the email address provided by the customer. It is useful for creating order lookup flows in chatbot automations, for example. With this function, it is possible to retrieve order information. Please note that in this case, the system will return **all orders** associated with the provided email address.

> **Note:** The `find_orders_by_email` function works exclusively through Automations, Campaigns, and Advanced Campaigns.

### Example of Use

Example of how to use the `find_orders_by_email` function to retrieve orders associated with a given email:

```twig theme={null}
{% set data = find_orders_by_email(email) %}

{% if data is not empty and data.order is not empty %}
*#{{ data.order.number }}*
{% if data.order.payment_method == 'BOLETO' %}🏷 _Boleto_{% elseif data.order.payment_method == 'CREDIT_CARD' %}💳 _Credit Card_{% elseif data.order.payment_method == 'PIX' %}🤳🏼 _Pix_{% else %}🏷 _Other_{% endif %}

{% if data.order.payment_status == 'PAID' %}✅ _Paid_{% elseif data.order.payment_status == 'PENDING' %}⏳ _Pending_{% else %}❌ _Not paid_{% endif %}

{% if data.order.tracking_numbers_url is not empty %}🚚 {{ data.order.tracking_numbers_url }}{% else %}🚚 _Shipment pending_{% endif %}
{% else %}
No order associated with the email: {{ email }}.
{% endif %}
```

### Output Example of the Code

<img src="https://mintcdn.com/reportana/9HogJxt6BTsd31jh/findOrderByEmailRS-en.png?fit=max&auto=format&n=9HogJxt6BTsd31jh&q=85&s=a8fd662581e85b8e4309ba8ab4d6fbfb" alt="Result of the `find_order_by_email` Filter" width="759" height="636" data-path="findOrderByEmailRS-en.png" />

In this example, we searched for orders associated with the email "[example@email.com](mailto:example@email.com)" using the `find_orders_by_email` function. Since there are orders with this email in our sample store, the message with the order information was displayed.
