Pagination doesn't work when order by TOTAL_SALES
Describe the bug When I set up a pagination ordering my products by TOTAL_SALES, the first 2 products constantly come back as first and second results.
To Reproduce 0 - Run the query below a first time and take note of the first 2 results 1 - Send the same query but this time with the cursor previously retrieved from the endCursor field 2 - Note that the first 2 results are the same as for the first query
query topSalesProducts($cursor: String, $first: Int) {
products(
where: {type: SIMPLE, orderby: {field: TOTAL_SALES, order: DESC}}
first: $first
after: $cursor
) {
nodes {
... on SimpleProduct {
databaseId
name
}
}
pageInfo {
endCursor
}
}
}
Expected behavior The first 2 results should not reappear once the cursor has been filled in
Plugin Versions
- WooGraphQL Version: 0.18.3
- WPGraphQL Version: 1.23.0
- WordPress Version: 6.5.2
- WooCommerce Version: 7.9.0
Additional context The bug only appear since the v0.16.0
@kidunot89 It seems that with Woographql version V0.20.0, products ordered by TOTAL_SALES are no longer ordered at all by TOP_SALES. Am I the only one with this error?
@Shazamepool yup, using the order also breaks the search, i recommend not updating this plugin if you have something that's working reliably.