6 October 2022
B2BCustomersProject configurationProduct catalogCartsOrdersQuotesGraphQL
We have released Business Units in public beta. This new feature allows you to model companies and their divisions in Composable Commerce. You can assign Customers to Business Units to manage Carts, Orders, and Quotes on behalf of companies. With the help of Stores, Business Units can support company-specific products and pricing. When linked to a Business Unit, Carts, Orders, and Quotes will validate a Customer's role within the Business Unit. This feature is part of Composable Commerce for B2B and will be subject to additional terms and pricing.
Changes:
- [API] Added Business Units and My Business Units APIs.
- [API] Added field
businessUnitto Carts. - [API] Added field
businessUnitto Orders. - [API] Added field
businessUnitto Quote Requests, Staged Quotes, and Quotes. - [API] Added field
businessUnitsto Projects. - [API] Added update action Change My Business Unit Status on Creation to Project.
- [API] Added Messages for Business Units.
- [GraphQL API] Added the following types to the GraphQL schema:
AddBusinessUnitAddress,AddBusinessUnitAssociate,AddBusinessUnitBillingAddressId,AddBusinessUnitShippingAddressId,AddBusinessUnitStore,AddMyBusinessUnitAddress,AddMyBusinessUnitBillingAddressId,AddMyBusinessUnitShippingAddressId,Associate,AssociateDraft,AssociateRole,BusinessUnit,BusinessUnitAddressAdded,BusinessUnitAddressChanged,BusinessUnitAddressRemoved,BusinessUnitAssociateAdded,BusinessUnitAssociateChanged,BusinessUnitAssociateRemoved,BusinessUnitAssociatesSet,BusinessUnitBillingAddressAdded,BusinessUnitBillingAddressRemoved,BusinessUnitConfiguration,BusinessUnitContactEmailSet,BusinessUnitCreated,BusinessUnitDefaultBillingAddressSet,BusinessUnitDefaultShippingAddressSet,BusinessUnitDeleted,BusinessUnitDraft,BusinessUnitNameChanged,BusinessUnitParentChanged,BusinessUnitQueryResult,BusinessUnitShippingAddressAdded,BusinessUnitShippingAddressRemoved,BusinessUnitStatus,BusinessUnitStatusChanged,BusinessUnitStoreAdded,BusinessUnitStoreModeChanged,BusinessUnitStoreRemoved,BusinessUnitStoresSet,BusinessUnitType,BusinessUnitUpdateAction,ChangeBusinessUnitAddress,ChangeBusinessUnitAssociate,ChangeBusinessUnitName,ChangeBusinessUnitParentUnit,ChangeBusinessUnitStatus,ChangeMyBusinessUnitAddress,ChangeMyBusinessUnitAssociate,ChangeMyBusinessUnitName,ChangeMyBusinessUnitParentUnit,ChangeProjectSettingsMyBusinessUnitStatusOnCreation,MyBusinessUnitDraft,MyBusinessUnitUpdateAction,RemoveBusinessUnitAddress,RemoveBusinessUnitAssociate,RemoveBusinessUnitBillingAddressId,RemoveBusinessUnitShippingAddressId,RemoveBusinessUnitStore,RemoveMyBusinessUnitAddress,RemoveMyBusinessUnitAssociate,RemoveMyBusinessUnitBillingAddressId,RemoveMyBusinessUnitShippingAddressId,SetBusinessUnitAddressCustomField,SetBusinessUnitAddressCustomType,SetBusinessUnitAssociates,SetBusinessUnitContactEmail,SetBusinessUnitCustomField,SetBusinessUnitCustomType,SetBusinessUnitDefaultBillingAddress,SetBusinessUnitDefaultShippingAddress,SetBusinessUnitStoreMode,SetBusinessUnitStores,SetCartBusinessUnit,SetMyBusinessUnitAddressCustomField,SetMyBusinessUnitAddressCustomType,SetMyBusinessUnitContactEmail,SetMyBusinessUnitCustomField,SetMyBusinessUnitCustomType,SetMyBusinessUnitDefaultBillingAddress,SetMyBusinessUnitDefaultShippingAddress. - [GraphQL API] Changed the
Metype:- Added the
businessUnitsfield to theMetype. - Added the
businessUnitfield to theMetype.
- Added the
- [GraphQL API] Changed the
Querytype:- Added the
businessUnitsfield to theQuerytype. - Added the
businessUnitfield to theQuerytype.
- Added the
- [GraphQL API] Changed the
MyCartUpdateActiontype:- Input field
setBusinessUnitwas added toMyCartUpdateActiontype
- Input field
- [GraphQL API] Changed the
StagedQuotetype:- Added the
businessUnitfield to theStagedQuotetype.
- Added the
- [GraphQL API] Changed the
Quotetype:- Added the
businessUnitfield to theQuotetype.
- Added the
- [GraphQL API] Changed the
CartUpdateActiontype:- Input field
setBusinessUnitwas added toCartUpdateActiontype
- Input field
- [GraphQL API] Changed the
Carttype:- Added the
businessUnitfield to theCarttype.
- Added the
- [GraphQL API] Changed the
Mutationtype:- Added the
updateBusinessUnitfield to theMutationtype. - Added the
createBusinessUnitfield to theMutationtype. - Added the
updateMyBusinessUnitfield to theMutationtype. - Added the
createMyBusinessUnitfield to theMutationtype. - Added the
deleteBusinessUnitfield to theMutationtype.
- Added the
- [GraphQL API] Changed the
ProjectSettingsUpdateActiontype:- Input field
changeMyBusinessUnitStatusOnCreationwas added toProjectSettingsUpdateActiontype
- Input field
- [GraphQL API] Changed the
Ordertype:- Added the
businessUnitfield to theOrdertype.
- Added the
- [GraphQL API] Changed the
QuoteRequesttype:- Added the
businessUnitfield to theQuoteRequesttype.
- Added the
The following changes were introduced in terms of GraphQL SDL:
extend type Me {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
businessUnit(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): BusinessUnit
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
businessUnits(where: String, sort: [String!], limit: Int, offset: Int): BusinessUnitQueryResult!
}
extend type Query {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
businessUnit(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): BusinessUnit
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
businessUnits(where: String, sort: [String!], limit: Int, offset: Int): BusinessUnitQueryResult!
}
extend type Cart {
businessUnit: KeyReference
}
extend type StagedQuote {
businessUnit: KeyReference
}
extend type Quote {
businessUnit: KeyReference
}
extend type Mutation {
createBusinessUnit(draft: BusinessUnitDraft!): BusinessUnit
createMyBusinessUnit(draft: MyBusinessUnitDraft!): BusinessUnit
deleteBusinessUnit(version: Long!, personalDataErasure: Boolean = false,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): BusinessUnit
updateBusinessUnit(version: Long!, actions: [BusinessUnitUpdateAction!]!,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): BusinessUnit
updateMyBusinessUnit(version: Long!, actions: [MyBusinessUnitUpdateAction!]!,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): BusinessUnit
}
extend type Order {
businessUnit: KeyReference
}
extend type QuoteRequest {
businessUnit: KeyReference
}
extend input CartUpdateAction {
setBusinessUnit: SetCartBusinessUnit
}
extend input MyCartUpdateAction {
setBusinessUnit: SetCartBusinessUnit
}
extend input ProjectSettingsUpdateAction {
changeMyBusinessUnitStatusOnCreation: ChangeProjectSettingsMyBusinessUnitStatusOnCreation
}
input AddBusinessUnitAddress {
address: AddressInput!
}
input AddBusinessUnitAssociate {
associate: AssociateDraft!
}
input AddBusinessUnitBillingAddressId {
addressId: String
addressKey: String
}
input AddBusinessUnitShippingAddressId {
addressId: String
addressKey: String
}
input AddBusinessUnitStore {
store: ResourceIdentifierInput!
}
input AddMyBusinessUnitAddress {
address: AddressInput!
}
input AddMyBusinessUnitBillingAddressId {
addressId: String
addressKey: String
}
input AddMyBusinessUnitShippingAddressId {
addressId: String
addressKey: String
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type Associate {
roles: [AssociateRole!]!
customerRef: Reference
customer: Customer
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input AssociateDraft {
roles: [AssociateRole!]!
customer: ResourceIdentifierInput!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
enum AssociateRole {
Admin
Buyer
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type BusinessUnit implements Versioned {
key: String!
name: String!
contactEmail: String
addresses: [Address!]!
defaultShippingAddress: Address
defaultBillingAddress: Address
defaultShippingAddressId: String
defaultBillingAddressId: String
shippingAddresses: [Address!]!
billingAddresses: [Address!]!
shippingAddressIds: [String!]!
billingAddressIds: [String!]!
status: BusinessUnitStatus!
storesRef: [KeyReference!]
stores: [Store!]
storeMode: String
unitType: BusinessUnitType!
associates: [Associate!]!
custom: CustomFieldsType
parentUnitRef: KeyReference
parentUnit: BusinessUnit
"This field contains the BusinessUnits KeyReferences from the Company to the parent Division of this BusinessUnit in that order."
ancestors: [BusinessUnit!]!
topLevelUnitRef: KeyReference
topLevelUnit: BusinessUnit!
id: String!
version: Long!
createdAt: DateTime!
lastModifiedAt: DateTime!
createdBy: Initiator
lastModifiedBy: Initiator
}
type BusinessUnitAddressAdded implements MessagePayload {
address: Address!
type: String!
}
type BusinessUnitAddressChanged implements MessagePayload {
address: Address!
type: String!
}
type BusinessUnitAddressRemoved implements MessagePayload {
address: Address!
type: String!
}
type BusinessUnitAssociateAdded implements MessagePayload {
associate: Associate!
type: String!
}
type BusinessUnitAssociateChanged implements MessagePayload {
associate: Associate!
type: String!
}
type BusinessUnitAssociateRemoved implements MessagePayload {
associate: Associate!
type: String!
}
type BusinessUnitAssociatesSet implements MessagePayload {
associates: [Associate!]!
type: String!
}
type BusinessUnitBillingAddressAdded implements MessagePayload {
address: Address!
type: String!
}
type BusinessUnitBillingAddressRemoved implements MessagePayload {
address: Address!
type: String!
}
type BusinessUnitConfiguration {
myBusinessUnitStatusOnCreation: BusinessUnitStatus!
}
type BusinessUnitContactEmailSet implements MessagePayload {
contactEmail: String
type: String!
}
type BusinessUnitCreated implements MessagePayload {
businessUnit: BusinessUnit!
type: String!
}
type BusinessUnitDefaultBillingAddressSet implements MessagePayload {
address: Address
type: String!
}
type BusinessUnitDefaultShippingAddressSet implements MessagePayload {
address: Address
type: String!
}
type BusinessUnitDeleted implements MessagePayload {
type: String!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input BusinessUnitDraft {
key: String!
name: String!
contactEmail: String
addresses: [AddressInput!]
"The index of the address in the `addresses` list. The `defaultBillingAddressId` of the customer will be set to the ID of that address."
defaultBillingAddress: Int
"The index of the address in the `addresses` list. The `defaultShippingAddressId` of the customer will be set to the ID of that address."
defaultShippingAddress: Int
"The indices of the shipping addresses in the `addresses` list. The `shippingAddressIds` of the `Customer` will be set to the IDs of that addresses."
shippingAddresses: [Int!] = []
"The indices of the billing addresses in the `addresses` list. The `billingAddressIds` of the customer will be set to the IDs of that addresses."
billingAddresses: [Int!] = []
custom: CustomFieldsDraft
unitType: BusinessUnitType!
storeMode: String
parentUnit: ResourceIdentifierInput
stores: [ResourceIdentifierInput!]
associates: [AssociateDraft!]
}
type BusinessUnitNameChanged implements MessagePayload {
name: String!
type: String!
}
type BusinessUnitParentChanged implements MessagePayload {
oldParentUnit: KeyReference
newParentUnit: KeyReference
type: String!
}
type BusinessUnitQueryResult {
offset: Int!
count: Int!
total: Long!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
exists: Boolean!
results: [BusinessUnit!]!
}
type BusinessUnitShippingAddressAdded implements MessagePayload {
address: Address!
type: String!
}
type BusinessUnitShippingAddressRemoved implements MessagePayload {
address: Address!
type: String!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
enum BusinessUnitStatus {
Active
Inactive
}
type BusinessUnitStatusChanged implements MessagePayload {
status: BusinessUnitStatus!
type: String!
}
type BusinessUnitStoreAdded implements MessagePayload {
store: KeyReference!
type: String!
}
type BusinessUnitStoreModeChanged implements MessagePayload {
storeMode: String!
oldStoreMode: String!
stores: [KeyReference!]
oldStores: [KeyReference!]
type: String!
}
type BusinessUnitStoreRemoved implements MessagePayload {
store: KeyReference!
type: String!
}
type BusinessUnitStoresSet implements MessagePayload {
stores: [KeyReference!]!
type: String!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
enum BusinessUnitType {
Company
Division
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input BusinessUnitUpdateAction {
addAddress: AddBusinessUnitAddress
addAssociate: AddBusinessUnitAssociate
addBillingAddressId: AddBusinessUnitBillingAddressId
addShippingAddressId: AddBusinessUnitShippingAddressId
addStore: AddBusinessUnitStore
changeAddress: ChangeBusinessUnitAddress
changeAssociate: ChangeBusinessUnitAssociate
changeName: ChangeBusinessUnitName
changeParentUnit: ChangeBusinessUnitParentUnit
changeStatus: ChangeBusinessUnitStatus
removeAddress: RemoveBusinessUnitAddress
removeAssociate: RemoveBusinessUnitAssociate
removeBillingAddressId: RemoveBusinessUnitBillingAddressId
removeShippingAddressId: RemoveBusinessUnitShippingAddressId
removeStore: RemoveBusinessUnitStore
setAddressCustomField: SetBusinessUnitAddressCustomField
setAddressCustomType: SetBusinessUnitAddressCustomType
setAssociates: SetBusinessUnitAssociates
setContactEmail: SetBusinessUnitContactEmail
setCustomField: SetBusinessUnitCustomField
setCustomType: SetBusinessUnitCustomType
setDefaultBillingAddress: SetBusinessUnitDefaultBillingAddress
setDefaultShippingAddress: SetBusinessUnitDefaultShippingAddress
setStores: SetBusinessUnitStores
setStoreMode: SetBusinessUnitStoreMode
}
input ChangeBusinessUnitAddress {
addressId: String
addressKey: String
address: AddressInput!
}
input ChangeBusinessUnitAssociate {
associate: AssociateDraft!
}
input ChangeBusinessUnitName {
name: String!
}
input ChangeBusinessUnitParentUnit {
parentUnit: ResourceIdentifierInput!
}
input ChangeBusinessUnitStatus {
status: BusinessUnitStatus!
}
input ChangeMyBusinessUnitAddress {
addressId: String
addressKey: String
address: AddressInput!
}
input ChangeMyBusinessUnitAssociate {
associate: AssociateDraft!
}
input ChangeMyBusinessUnitName {
name: String!
}
input ChangeMyBusinessUnitParentUnit {
parentUnit: ResourceIdentifierInput!
}
input ChangeProjectSettingsMyBusinessUnitStatusOnCreation {
status: BusinessUnitStatus!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input MyBusinessUnitDraft {
key: String!
name: String!
contactEmail: String
addresses: [AddressInput!]
"The index of the address in the `addresses` list. The `defaultBillingAddressId` of the customer will be set to the ID of that address."
defaultBillingAddress: Int
"The index of the address in the `addresses` list. The `defaultShippingAddressId` of the customer will be set to the ID of that address."
defaultShippingAddress: Int
"The indices of the shipping addresses in the `addresses` list. The `shippingAddressIds` of the `Customer` will be set to the IDs of that addresses."
shippingAddresses: [Int!] = []
"The indices of the billing addresses in the `addresses` list. The `billingAddressIds` of the customer will be set to the IDs of that addresses."
billingAddresses: [Int!] = []
custom: CustomFieldsDraft
unitType: BusinessUnitType!
storeMode: String
parentUnit: ResourceIdentifierInput
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input MyBusinessUnitUpdateAction {
addAddress: AddMyBusinessUnitAddress
addBillingAddressId: AddMyBusinessUnitBillingAddressId
addShippingAddressId: AddMyBusinessUnitShippingAddressId
changeAddress: ChangeMyBusinessUnitAddress
changeAssociate: ChangeMyBusinessUnitAssociate
changeName: ChangeMyBusinessUnitName
changeParentUnit: ChangeMyBusinessUnitParentUnit
removeAddress: RemoveMyBusinessUnitAddress
removeAssociate: RemoveMyBusinessUnitAssociate
removeBillingAddressId: RemoveMyBusinessUnitBillingAddressId
removeShippingAddressId: RemoveMyBusinessUnitShippingAddressId
setAddressCustomField: SetMyBusinessUnitAddressCustomField
setAddressCustomType: SetMyBusinessUnitAddressCustomType
setContactEmail: SetMyBusinessUnitContactEmail
setCustomField: SetMyBusinessUnitCustomField
setCustomType: SetMyBusinessUnitCustomType
setDefaultBillingAddress: SetMyBusinessUnitDefaultBillingAddress
setDefaultShippingAddress: SetMyBusinessUnitDefaultShippingAddress
}
input RemoveBusinessUnitAddress {
addressId: String
addressKey: String
}
input RemoveBusinessUnitAssociate {
customer: ResourceIdentifierInput!
}
input RemoveBusinessUnitBillingAddressId {
addressId: String
addressKey: String
}
input RemoveBusinessUnitShippingAddressId {
addressId: String
addressKey: String
}
input RemoveBusinessUnitStore {
store: ResourceIdentifierInput!
}
input RemoveMyBusinessUnitAddress {
addressId: String
addressKey: String
}
input RemoveMyBusinessUnitAssociate {
customer: ResourceIdentifierInput!
}
input RemoveMyBusinessUnitBillingAddressId {
addressId: String
addressKey: String
}
input RemoveMyBusinessUnitShippingAddressId {
addressId: String
addressKey: String
}
input SetBusinessUnitAddressCustomField {
addressId: String
addressKey: String
name: String!
value: String
}
input SetBusinessUnitAddressCustomType {
addressId: String
addressKey: String
fields: [CustomFieldInput!]
type: ResourceIdentifierInput
typeKey: String
typeId: String
}
input SetBusinessUnitAssociates {
associates: [AssociateDraft!] = []
}
input SetBusinessUnitContactEmail {
contactEmail: String
}
input SetBusinessUnitCustomField {
name: String!
value: String
}
input SetBusinessUnitCustomType {
fields: [CustomFieldInput!]
type: ResourceIdentifierInput
typeKey: String
typeId: String
}
input SetBusinessUnitDefaultBillingAddress {
addressId: String
addressKey: String
}
input SetBusinessUnitDefaultShippingAddress {
addressId: String
addressKey: String
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input SetBusinessUnitStoreMode {
stores: [ResourceIdentifierInput!]
storeMode: String
}
input SetBusinessUnitStores {
stores: [ResourceIdentifierInput!]!
}
input SetCartBusinessUnit {
businessUnit: ResourceIdentifierInput!
}
input SetMyBusinessUnitAddressCustomField {
addressId: String
addressKey: String
name: String!
value: String
}
input SetMyBusinessUnitAddressCustomType {
addressId: String
addressKey: String
fields: [CustomFieldInput!]
type: ResourceIdentifierInput
typeKey: String
typeId: String
}
input SetMyBusinessUnitContactEmail {
contactEmail: String
}
input SetMyBusinessUnitCustomField {
name: String!
value: String
}
input SetMyBusinessUnitCustomType {
fields: [CustomFieldInput!]
type: ResourceIdentifierInput
typeKey: String
typeId: String
}
input SetMyBusinessUnitDefaultBillingAddress {
addressId: String
addressKey: String
}
input SetMyBusinessUnitDefaultShippingAddress {
addressId: String
addressKey: String
}