What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

mutation companyCreate INVALID_INPUT at input.companyLocation.billingAddress

mutation companyCreate INVALID_INPUT at input.companyLocation.billingAddress

Frank01
Shopify Partner
1 0 2

Hi,

I am executing a companyCreate mutation using the Shopify GraphiQL App, however I get an error on path "input.companyLocation.billingAddress" which isn't that descriptive: "Invalid input.". Below is the query, variables and response, what could be the issue here?

Query:

mutation companyCreate($input: CompanyCreateInput!) {
  companyCreate(input: $input) {
    company {
      id
    }
    userErrors {
      code
      field
      message
    }
  }
}

 

Variables:

{
  "input": {
    "company": {
      "customerSince": "2022-08-30",
      "externalId": "",
      "name": "Better Call Saul",
      "note": "Speedy justice for you"
    },
    "companyContact": {
      "email": "justiceforyou@bettercallsaul.com",
      "firstName": "Saul",
      "lastName": "Goodman",
      "locale": "en_US",
      "phone": "+15058425662",
      "title": ""
    },
    "companyLocation": {
      "billingAddress": {
        "address1": "9800 Montgomery Boulevard",
        "address2": "",
        "city": "Albuquerque",
        "countryCode": "US",
        "firstName": "Saul",
        "lastName": "Goodman",
        "phone": "+15058425662",
        "zip": "87111",
        "zoneCode": "NM"
      },
      "billingSameAsShipping": true,
      "buyerExperienceConfiguration": {
        "checkoutToDraft": true
      },
      "externalId": "",
      "locale": "en_US",
      "name": "Saul Goodman",
      "note": "",
      "phone": "+15058425662",
      "taxExemptions": [],
      "taxRegistrationId": ""
    }
  }
}


Response:

{
  "data": {
    "companyCreate": {
      "company": null,
      "userErrors": [
        {
          "code": "INVALID_INPUT",
          "field": [
            "input",
            "companyLocation",
            "billingAddress"
          ],
          "message": "Invalid input."
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 10,
      "actualQueryCost": 10,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1990,
        "restoreRate": 100
      }
    }
  }
}
Replies 7 (7)

fortuna-001
Shopify Partner
6 0 2

I'm having  the exact same issue. Did you ever resolve this?

Sy4zwin
Visitor
1 0 0

I am having the same issue. userErrors only says INVALID_INPUT

ftballguy45
Shopify Partner
32 0 12

frustrating - exact same error - this must be an issue

fortuna-001
Shopify Partner
6 0 2
I think I’ve figured it out. Quietly and behind the scenes Shopify has crippled the ability to use companies and b2b features on the normal tier of their platform and wants all B2B services to happen on Shopify plus at the $1500 per month price tag.
ShopifyDevSup
Shopify Staff
1453 238 525

Hey @Frank01 , @ftballguy45 , and @fortuna-001 

The docs for companyCreate do say that the mutation is only available on Plus stores, but the issue with the code above is that the CompanyCreateInput.
companyLocation.billingSameAsShipping field is set to true, which means the required Billing address is ignored and there is no Shipping address to add the necessary info:

 

I will flag this with our developers to request that a clearer error message gets raised if no address is provided.

 

All the best.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

sravanikat
Shopify Partner
3 0 0

Hi,

Exactly, I have same issue. After removing the first name and last name fields from billing and shipping addresses the issue was fixed.

 

fortuna-001
Shopify Partner
6 0 2
Interesting thanks for the Input. Also entering state and country code nodes in the graph call instead of state and country like the example shows helps.