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:
{% 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

Result of the `find_order_by_email` Filter In this example, we searched for orders associated with the email “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.