Describe the bug
I'm trying to create an Woocommerce account page with React. I'm using a Woocommerce plugin to add extra fields to the billing and shipping form and it saves the fields into meta data.
I've found a bug when trying to query the meta data of a customer.
To Reproduce
Steps to reproduce the behavior:
query MyQuery {
customers {
edges {
node {
metaData {
key
value
}
}
}
}
}
"errors": [
{
"message": "Internal server error",
"extensions": {
"category": "internal"
},
"locations": [
{
"line": 7,
"column": 11
}
],
"path": [
"customers",
"edges",
1,
"node",
"metaData",
1,
"value"
],
Expected behavior
The query should return customer's meta data.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
I'm using:
I've found that the internal error occurs when trying to query the meta data of the admin user.
I am getting "internal server error" when I am trying to fetch customer data with customer's orders/lastOrder. If I remove the orders from the query everything works fine. But I need the orders getting fetched by the customer query.
I am also getting an error trying to retrieve an Order, specifically:
Call to undefined method Automattic\WooCommerce\Admin\Overrides\Order::is_private()
_ok, for me this was an issue about calling the wrong Order class. I'm having an different issue which I'll take up else where._
totally, lying still getting this, its from trying to pass an Order back from a custom mutation, I think I'm not creating the right Order class.
@aresrioja10 You're issues related to the Customer meta should be resolved with both #430 and @believelody's #402
@pandabrand We're discussing your issue in the Slack and it appears to be an misunderstand of permission surrounding the root-level orders() query.
@mohaimenmahi Sounds like you may have stumble upon a new bug. Please open a new issue with the query you are attempting to run and any screenshots you can share of your GraphQL client.
I'm not having an error. but After the update, the metadata update is not working on the customer:
mutation MyMutation {
updateCustomer(input: {billing: {state: "NJ"}, metaData: {key: "test_key", value: "value test"}}) {
customer {
email
lastName
metaData {
key
value
id
}
}
}
}
Mutation Response
{
"key": "test_key",
"value": "value test",
"id": null
}
Notice the id is null after performing the mutation.
After using the query to fetch current customer the new metaData is not present.
WPGraphQL WooCommerce (WooGraphQL): Version 0.8.1
WP GraphQL: Version 1.3.9
WP: Version 5.7.2
After I pass the customer id on the mutation, the metaData gets save correctly..
Most helpful comment
@aresrioja10 You're issues related to the Customer meta should be resolved with both #430 and @believelody's #402
@pandabrand We're discussing your issue in the Slack and it appears to be an misunderstand of permission surrounding the root-level
orders()query.@mohaimenmahi Sounds like you may have stumble upon a new bug. Please open a new issue with the query you are attempting to run and any screenshots you can share of your GraphQL client.