How can I export Shopify orders with overdue payments?

The Shopify API doesn't have an "Overdue" payment status.

However, there's a payment_terms field that has a sub-attribute called payment_schedules which contains the due dates that we can use for filtering.

This can get a bit complicated as it's also possible to have multiple payment schedules, so we have to account for this as well in the filters.

In EZ Exporter, you can follow the steps below to filter orders that have an overdue payment (you can also use the template "Orders with Overdue Payments" which already has this configured).

1. Pull out the due dates and check if at least one due date is overdue using this formula in the Calculated Fields section::

"yes" if [i for i in to_list(get_attribute_value({{ payment_terms.payment_schedules }}, "due_at")) if to_datetime({{ _current_datetime }}) > to_datetime(i)] else "no"

Assign the column name "Is Overdue" to this Calculated Field.

2. Under Custom Filters > User-Defined Fields, add this filter:

  • Is Overdue is equal to yes

3. (Optional) To exclude the "Is Overdue" column from the final export, add this column under Extra Options > Exclude Columns.


App: EZ Exporter

Tags: overdue payments, payment terms