Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination doesn't work when order by TOTAL_SALES #845

Open
Shazamepool opened this issue Apr 16, 2024 · 1 comment · Fixed by #849
Open

Pagination doesn't work when order by TOTAL_SALES #845

Shazamepool opened this issue Apr 16, 2024 · 1 comment · Fixed by #849
Labels
bug Something isn't working
Milestone

Comments

@Shazamepool
Copy link

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 kidunot89 added the bug Something isn't working label Apr 30, 2024
@kidunot89 kidunot89 added this to the v0.19.1 milestone Apr 30, 2024
@Shazamepool
Copy link
Author

@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?

@kidunot89 kidunot89 reopened this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants