data-src=../../../../../includes/saas-only.md
data-src=../../../../../includes/commerce-only.md
assignChildCompany mutation
data-variant=info
data-slots=text1
This mutation is part of the B2B Storefront Compatibility Package and is only available on Adobe Commerce as a Cloud Service.
The assignChildCompany mutation allows company administrators to assign a child company to a parent company within the company hierarchy. This mutation requires parentId and childId as unique IDs of the companies as parameters. This mutation returns a company_hierarchy object if successful.
Syntax
{
assignChildCompany(
input: AssignChildCompanyInput!
): AssignChildCompanyOutput
}
Example usage
The following example assigns a child company to a parent company by the company admin.
Request:
mutation assignChildCompany($parentId: ID!, $childId: ID!) {
assignChildCompany(
input: {parent_company_id: "ODM5", child_company_id: "ABCD=="}
) {
company_hierarchy {
parent {
name
}
children {
name
}
}
}
}
Response:
{
"data": {
"assignChildCompany": {
"company_hierarchy": {
"parent": {
"name": "ParentCompanyName"
},
"children": [
{
"name": "ChildCompanyName"
}
]
}
}
}
}