Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

B2B API Create Company with existing contact

quickfire
Shopify Partner
1 0 1

When you create a company in the admin panel it allows you to select from an existing customer. WHen you create one in the API (https://shopify.dev/docs/api/admin-graphql/unstable/mutations/companyCreate#field-companycreateinput...) it only seems to allow creation of a new customer with the new company.

How do i create a new company and attach an existing customer through the API?

Anybody know?

Replies 2 (2)

ShopifyDevSup
Shopify Staff
1242 201 438

Hi @quickfire ,

 

You are correct. 

 

Currently when you are creating a company for B2B you only have the option to do so with a 'new contact' and not an existing one. However, once you have created a company via the api, you can use the companyAssignCustomerAsContact mutation to add in an existing customer. 

 

This is a good example of the subtle differences between what you can do in the admin vs what you can accomplish via the API. I will pass this along to our development team for future consideration.

 

Hope that helps! 

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

ftballguy45
Shopify Partner
32 0 7

Currently cant even add a company via the GraphQL API - "Invalid input" is what you get