GraphQL new custom fields
The customFields field on GraphQL queries is deprecated in favor of the new custom field. customFields is still available for use in queries, but we strongly encourage all users to switch to using custom in GraphQL queries. For more information about this change, see Beta Features.
We are deprecating the existing customFields graphQL field present on all fields having custom fields for a better alternative.
In the new approach, all fields having custom fields have the new custom field exposes the following sub-fields:
type RawCustomField {name: String!value: Json!}type CustomFieldsType {typeRef: Reference!type: TypeDefinition"This field contains non-typed data. For a typed alternative, have a look at `customFields`."customFieldsRaw(includeNames: [String!],excludeNames: [String!]): [RawCustomField!]"This field contains typed data"customFields: Type!}
The customFields provides access to typed custom fields.
The new custom field improves the performance of the query as long as you don't use typed fields. For example:
fragment customFields on ProducePrice {custom {typeRef {id}rawCustomFields {namevalue}}}
If you use custom.customFields then you won't profit from the better performance.
- [GraphQL API] Added the following types to the GraphQL schema:
CustomFieldsType. - [GraphQL API] Changed the
Categorytype:- Added the
customfield to theCategorytype. - Field
customFieldsRawwas deprecated inCategorytype - Field
customFieldswas deprecated inCategorytype
- Added the
- [GraphQL API] Changed the
Channeltype:- Added the
customfield to theChanneltype. - Field
customFieldswas deprecated inChanneltype - Field
customFieldsRawwas deprecated inChanneltype
- Added the
- [GraphQL API] Changed the
ProductPricetype:- Added the
customfield to theProductPricetype. - Field
customFieldsRawwas deprecated inProductPricetype - Field
customFieldswas deprecated inProductPricetype
- Added the
- [GraphQL API] Changed the
Carttype:- Added the
customfield to theCarttype. - Field
customFieldsRawwas deprecated inCarttype - Field
customFieldswas deprecated inCarttype
- Added the
- [GraphQL API] Changed the
CustomerGrouptype:- Added the
customfield to theCustomerGrouptype. - Field
customFieldsRawwas deprecated inCustomerGrouptype - Field
customFieldswas deprecated inCustomerGrouptype
- Added the
- [GraphQL API] Changed the
Assettype:- Added the
customfield to theAssettype. - Field
customFieldswas deprecated inAssettype - Field
customFieldsRawwas deprecated inAssettype
- Added the
- [GraphQL API] Changed the
CustomLineItemtype:- Added the
customfield to theCustomLineItemtype. - Field
customFieldswas deprecated inCustomLineItemtype - Field
customFieldsRawwas deprecated inCustomLineItemtype
- Added the
- [GraphQL API] Changed the
Customertype:- Added the
customfield to theCustomertype. - Field
customFieldsRawwas deprecated inCustomertype - Field
customFieldswas deprecated inCustomertype
- Added the
- [GraphQL API] Changed the
CartDiscounttype:- Added the
customfield to theCartDiscounttype. - Field
customFieldswas deprecated inCartDiscounttype - Field
customFieldsRawwas deprecated inCartDiscounttype
- Added the
- [GraphQL API] Changed the
Paymenttype:- Added the
customfield to thePaymenttype. - Field
customFieldsRawwas deprecated inPaymenttype - Field
customFieldswas deprecated inPaymenttype
- Added the
- [GraphQL API] Changed the
CategorySearchtype:- Added the
customfield to theCategorySearchtype. - Field
customFieldswas deprecated inCategorySearchtype - Field
customFieldsRawwas deprecated inCategorySearchtype
- Added the
- [GraphQL API] Changed the
Ordertype:- Added the
customfield to theOrdertype. - Field
customFieldsRawwas deprecated inOrdertype - Field
customFieldswas deprecated inOrdertype
- Added the
- [GraphQL API] Changed the
InventoryEntrytype:- Added the
customfield to theInventoryEntrytype. - Field
customFieldswas deprecated inInventoryEntrytype - Field
customFieldsRawwas deprecated inInventoryEntrytype
- Added the
- [GraphQL API] Changed the
LineItemtype:- Added the
customfield to theLineItemtype. - Field
customFieldswas deprecated inLineItemtype - Field
customFieldsRawwas deprecated inLineItemtype
- Added the
- [GraphQL API] Changed the
DiscountCodetype:- Added the
customfield to theDiscountCodetype. - Field
customFieldswas deprecated inDiscountCodetype - Field
customFieldsRawwas deprecated inDiscountCodetype
- Added the
Introduced the following changes to the GraphQL schema (in SDL format):
extend type Category {custom: CustomFieldsType}extend type Channel {custom: CustomFieldsType}extend type ProductPrice {custom: CustomFieldsType}extend type Cart {custom: CustomFieldsType}extend type CustomerGroup {custom: CustomFieldsType}extend type Asset {custom: CustomFieldsType}extend type CustomLineItem {custom: CustomFieldsType}extend type Customer {custom: CustomFieldsType}extend type CartDiscount {custom: CustomFieldsType}extend type Payment {custom: CustomFieldsType}extend type CategorySearch {custom: CustomFieldsType}extend type Order {custom: CustomFieldsType}extend type InventoryEntry {custom: CustomFieldsType}extend type LineItem {custom: CustomFieldsType}extend type DiscountCode {custom: CustomFieldsType}type CustomFieldsType {typeRef: Reference!type: TypeDefinition"This field contains non-typed data. For a typed alternative, have a look at `customFields`."customFieldsRaw("""The names of the custom fields to include.If neither `includeNames` nor `excludeNames` are provided, then all custom fields are returned."""includeNames: [String!],"""The names of the custom fields to exclude.If neither `includeNames` nor `excludeNames` are provided, then all custom fields are returned."""excludeNames: [String!]): [RawCustomField!]"This field contains typed data"customFields: Type!}