How to filter only open orders on customer page

Hi there, we are trying to create that only list current customers’ open orders, and we want to sum up all the unfulfilled items so the customer knows how many are order items within an order that are available to ship. (note some orders is already partially fulfilled)

We are starting with “customers/account.liquid” and got the customer object and trying to loop through the orders. We noticed there is no way to just loop find out if an order is open on based on the documentation here https://shopify.dev/api/liquid/objects/order

customer.orders is returning all orders, I can then just look at the cancelled=false but it will return orders that are already closed as well.

How can I find out which orders are opened and which one are closed please?

Thank you!

Hi @bgbliss ,

You can add conditions to it, refer:

Code:

{% if order.fulfillment_status == 'Unfulfilled' %}

{% endif %}

Refer https://shopify.dev/api/liquid/objects/order#order-fulfillment_status

Hope it helps!

Thank you @LitCommerce for the answer. This solution will also return order that are unfulfilled but closed. Like those orders where some items are refunded.

Thank you

Hi @bgbliss ,

Refer:

  • pending: Shopify has created the fulfillment and is waiting for the third-party fulfillment service to transition it to ‘open’ or ‘success’.
  • open: The fulfillment has been acknowledged by the service and is in processing.
  • success: The fulfillment was successful.
  • cancelled: The fulfillment was cancelled.
  • error: There was an error with the fulfillment request.
  • failure: The fulfillment request failed.

Can you check with the following values?

Hope it helps!

Thank you~

1 Like