data-src=/includes/commerce-only.md

updateCompanyConfig mutation

data-src=/includes/scp-b2b-mutation.md

The updateCompanyConfig mutation updates configuration settings for the current company context. This mutation supports the following company address book settings:

Disabling the address book also disables the custom shipping address setting, even if custom_shipping_address_enabled is set to true in the same request.

This mutation requires a valid customer authentication token for a company admin or a company user assigned a role with the Magento_CompanyStorefrontCompatibility::manage_config (Manage Company Configuration) permission.

Syntax

mutation {
    updateCompanyConfig(
        input: UpdateCompanyConfigInput!
    ) {
        UpdateCompanyConfigOutput
    }
}

Reference

The updateCompanyConfig reference provides detailed information about the types and fields defined in this mutation.

Example usage

Enable the company address book and custom shipping addresses

The following example enables the company address book and allows custom shipping addresses to be entered at checkout.

Request:

mutation UpdateCompanyConfig {
    updateCompanyConfig(
        input: {
            address_book_enabled: true
            custom_shipping_address_enabled: true
        }
    ) {
        company {
            config {
                address_book_enabled
                address_book_custom_shipping_address_enabled
            }
        }
    }
}

Response:

{
  "data": {
    "updateCompanyConfig": {
      "company": {
        "config": {
          "address_book_enabled": true,
          "address_book_custom_shipping_address_enabled": true
        }
      }
    }
  }
}

Disable the company address book

The following example disables the company address book. The custom shipping address entry is disabled as well, although custom_shipping_address_enabled is not specified in the request.

Request:

mutation UpdateCompanyConfig {
    updateCompanyConfig(
        input: {
            address_book_enabled: false
        }
    ) {
        company {
            config {
                address_book_enabled
                address_book_custom_shipping_address_enabled
            }
        }
    }
}

Response:

{
  "data": {
    "updateCompanyConfig": {
      "company": {
        "config": {
          "address_book_enabled": false,
          "address_book_custom_shipping_address_enabled": false
        }
      }
    }
  }
}

Errors

Error
Description
"input" value should be specified
The input argument was not provided.
At least one supported configuration value must be specified.
Neither address_book_enabled nor custom_shipping_address_enabled was specified in input.
Company context is required.
Missing X-Adobe-Company header, or the customer is not a company user.
You do not have authorization to perform this action.
The company user is not assigned the Manage Company Configuration permission.