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

Update Customer mutation allows for invalid shipping input variables #269

Closed
ardiewen opened this issue Apr 29, 2020 · 1 comment · Fixed by #255
Closed

Update Customer mutation allows for invalid shipping input variables #269

ardiewen opened this issue Apr 29, 2020 · 1 comment · Fixed by #255
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ardiewen
Copy link
Contributor

Describe the bug

When running the updateCustomer mutation, the allowed shipping input variables include:

email
phone

According to The WC REST API Customer Properties documentation, these are not valid properties of the Shipping object.

To Reproduce
Steps to reproduce the behavior:

  1. Create an updateCustomer mutation:

With email input variable:

mutation UPDATE_CUSTOMER {
  updateCustomer(input: {shipping: { email: "test@test.com"}, clientMutationId: "some-set-of-strings"}) {
    clientMutationId
  }
}

Response:

{
  "errors": [
    {
      "debugMessage": "Call to undefined method WC_Customer::set_shipping_email()",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "updateCustomer"
      ]
    }
  ],
  "data": {
    "updateCustomer": null
  }
}

With phone input variable:

mutation UPDATE_CUSTOMER {
  updateCustomer(input: {shipping: {phone: "+19175551234", }, clientMutationId: "some-set-of-strings"}) {
    clientMutationId
  }
}

Response:

{
  "errors": [
    {
      "debugMessage": "Call to undefined method WC_Customer::set_shipping_phone()",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "updateCustomer"
      ]
    }
  ],
  "data": {
    "updateCustomer": null
  }
}

Expected behavior

Shouldn't have the option to add shipping email or phone as input variables.

Screenshots

Screen Shot 2020-04-29 at 11 44 09 AM

@kidunot89 kidunot89 added bug Something isn't working good first issue Good for newcomers labels Apr 30, 2020
@kidunot89
Copy link
Member

kidunot89 commented Apr 30, 2020

@ardiewen Yea, the CustomerAddressInput type used is by both the billing and shipping input fields.

It should be fine, if the mutation resolver just made to ignore the email and phone fields on the shipping field. 🤔

This was referenced May 1, 2020
@kidunot89 kidunot89 self-assigned this May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants