ListWithPagination function fails when status is passed to OrderListOptions

Topic summary

A developer encounters an issue using the ListWithPagination function from the go-shopify library when attempting to retrieve all Shopify orders (open, closed, and canceled).

The Problem:

  • When the Status field is set to “any” in OrderListOptions alongside pagination parameters, the Shopify API returns an error: “status cannot be passed when page_info is present”
  • This occurs when order counts exceed 250, requiring pagination
  • Without passing the Status parameter, pagination works correctly but only returns open orders—closed and canceled orders are inaccessible

Technical Context:

  • The code sets a 250-item limit (API maximum) and uses page_info for pagination
  • According to Shopify’s REST pagination documentation, page_info and status parameters are mutually exclusive
  • The current ListWithPagination function only supports passing limit and page_info, with no scope for the status field

Expected Solution:
The developer requests that the ListWithPagination function be enhanced to support the Status field, enabling retrieval of all order types through pagination.

References to related GitHub issues are provided for both the go-shopify library and a Steampipe plugin.

Summarized with AI on November 19. AI used: claude-sonnet-4-5-20250929.

Question
Is there a way by which we can list all the Shopify orders (including open, closed and canceled) using ListWithPagination function?

Roadblock
I tried the following code to extract the list of orders:

func listOrders(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) {
conn, err := connect(ctx, d)
if err != nil {
return nil, err
}

// max limit defined by the api is 250
// We are setting status to 'any' to get all the orders(open, closed, canceled)
options := goshopify.OrderListOptions{
ListOptions: goshopify.ListOptions{},
Status: "any",
}

maxLimit := int64(250)
// set the limit if a lower limit is passed in query context
limit := d.QueryContext.Limit
if limit != nil {
if *limit < maxLimit {
options.ListOptions.Limit = int(*limit)
}
} else {
options.ListOptions.Limit = int(maxLimit)
}

for {
orders, paginator, err := conn.Order.ListWithPagination(options)
if err != nil {
plugin.Logger(ctx).Error("shopify_order.listOrders", "api_error", err)
return nil, err
}

for _, order := range orders {
d.StreamListItem(ctx, order)

if d.RowsRemaining(ctx) == 0 {
return nil, nil
}
}

if paginator.NextPageOptions == nil {
return nil, nil
}

options.ListOptions.PageInfo = paginator.NextPageOptions.PageInfo

}
}

However if the number of orders is more than 250, the API returns the following error -
status: status cannot be passed when page_info is present. See [https://shopify.dev/api/usage/pagination-rest](https://shopify.dev/api/usage/pagination-rest) for more information.

This link suggests that we can only pass limit and page_info, but there is no scope to pass the status field.

Alternatives considered
If I don’t pass the Status parameter to the OrderListOptions, the results are correctly paginated, however, the caveat is that I cannot access the closed or canceled orders.

Expectation
ListWithPagination function should include the option to pass the Status field so that we can retrieve all kinds of orders.

Additional Context
Issue reference - https://github.com/turbot/steampipe-plugin-shopify/issues/25
Please let me know if additional details are needed. Any kind suggestion would be very helpful. Thanks!!

Issue reference - https://github.com/bold-commerce/go-shopify/issues/215