Skip to content

Woocommerce 9.6.0 breaks GetOrders request #919

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

Open
catative opened this issue Feb 18, 2025 · 4 comments
Open

Woocommerce 9.6.0 breaks GetOrders request #919

catative opened this issue Feb 18, 2025 · 4 comments
Labels
awaiting author response Awaiting response from Issue/PR author

Comments

@catative
Copy link

catative commented Feb 18, 2025

Describe the bug

A request like that:
query GetOrders($customerId: Int!) { customer(customerId: $customerId) { orders { nodes { id databaseId date status total lineItems { nodes { productId quantity total } } billing { firstName lastName address1 city state postcode country } shipping { firstName lastName address1 address2 city state postcode country } } } } }

starts returning an empty array:
{ "data": { "customer": { "orders": { "nodes": [] } } }, "extensions": { "debug": [ { "type": "DEBUG_LOGS_INACTIVE", "message": "GraphQL Debug logging is not active. To see debug logs, GRAPHQL_DEBUG must be enabled." } ] } }

instead of orders if you update the Woocommerce plugin to version 9.6.0 and above. To authorize a request as a Bearer Token, I use the latest version of the WPGraphQL JWT Authentication plugin (0.7.0).

To Reproduce

Steps to reproduce the behavior:

  1. Install Woocommerce plugin (9.6.0 and above)
  2. Install latest WPGraphQL (1.32.1), WPGraphQL WooCommerce (WooGraphQL) (0.21.1) and WPGraphQL JWT Authentication (0.7.0) plugins
  3. Make login request like that to get actual authToken:

mutation LoginUser { login( input: { username: "test@test.com", password: "12345" } ) { authToken refreshToken customer { id databaseId firstName lastName email username billing { phone address1 address2 city postcode state lastName firstName email country company address1 } } } }

  1. Make GetOrders request with actual authToken

Expected behavior

Should return an array of orders like that:

{ "data": { "customer": { "orders": { "nodes": [ { "id": "b3JkZXI6MjUyODg=", "databaseId": 25288, "date": "2025-02-18T11:16:27+00:00", "status": "PENDING", "total": "1000,00 ₸", "lineItems": { "nodes": [ { "productId": null, "quantity": 2, "total": "1000" } ] }, "billing": { "firstName": "User", "lastName": null, "address1": "Street example, 1", "city": "City example", "state": null, "postcode": null, "country": null }, "shipping": { "firstName": "User", "lastName": null, "address1": "Street example, 1", "address2": null, "city": "City example", "state": null, "postcode": null, "country": null } },

Desktop (please complete the following information):

  • OS: Linux Kubuntu 22.04
  • Browser: chrome
  • Version: 130.0.6723.116

Plugin Versions

  • WooGraphQL Version: 0.21.1
  • WPGraphQL Version: 1.32.1
  • WPGraphQL JWT Authentication: 0.7.0
  • WordPress Version: 6.7.2
  • WooCommerce Version: 9.6.0 and above
@catative
Copy link
Author

UPD: The emptiness of the array is also affected by the enabled WooCommerce Advanced Bulk Edit plugin (5.2) , even with WooCommerce 9.5.2

@alejdig
Copy link

alejdig commented Feb 19, 2025

@catative I don't think it works on other versions either, i defaulted to using the Rest Api

@kidunot89
Copy link
Collaborator

@catative @alejdig Have you tried removing the customerId parameter.

query GetOrders {
  customer {
    orders {
      nodes {
        id
        databaseId
        date
        status
        total
        lineItems {
          nodes {
            productId
            quantity
            total
          }
        }
        billing {
          firstName
          lastName
          address1
          city
          state
          postcode
          country
        }
        shipping {
          firstName
          lastName
          address1
          address2
          city
          state
          postcode
          country
        }
      }
    }
  }
}

When an auth token and/or session token is provided, the customer query defaults to the current session user's customer properties.

@kidunot89 kidunot89 added the awaiting author response Awaiting response from Issue/PR author label Feb 24, 2025
@kidunot89
Copy link
Collaborator

@catative @alejdig Any movement on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting author response Awaiting response from Issue/PR author
Projects
None yet
Development

No branches or pull requests

3 participants