Introduction

The find_order_by_number function is used to search for orders based on the order number provided by the customer. It is useful for retrieving order data within chatbot automations, for example, allowing you to display information about a specific order. Please note that the system will only retrieve the order associated with the provided order number.

Note: The find_order_by_number function works exclusively through Automations, Campaigns, and Advanced Campaigns.

Example of use

Example of how to use the find_order_by_number function:

{% set data = find_order_by_number(number) %}

{% 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 number: {{ number }}.
{% endif %}

Example Output Code

In the example above, we use the find_order_by_number function to search for an order based on the number provided by the customer, which is stored in the number variable, returning the order information.