Filter order by order status I am creating a custom dashboard for delivery guys where I want to show the order list in two divs. One is Pending Orders and second is History.
Basically I want to filter my order list by order status.
Here is code:

{% set pastOrders = craft.commerce.orders.relatedTo({targetElement: currentUser, field: 'deliveryGuy'}).find() %}
{% for order in pastOrders %}
   {{order.id}}
   {{order.orderStatus.name}}
{% endfor %}
I would run two queries and then you could utilise the completed() parameter:
https://craftcommerce.com/docs/craft-commerce-orders#completed

{% set pastOrders = craft.commerce.orders.completed(true).relatedTo({targetElement: currentUser, field: 'deliveryGuy'}).find() %}
{% for order in pastOrders %}
   {{order.id}}
   {{order.orderStatus.name}}
{% endfor %}

{% set pendingOrders = craft.commerce.orders.completed(false).relatedTo({targetElement: currentUser, field: 'deliveryGuy'}).find() %}
{% for order in pendingOrders %}
   {{order.id}}
   {{order.orderStatus.name}}
{% endfor %}