27 April 2018
Enhancement
GraphQL
  • [GraphQL API] Added new field DiscountCode.applicationCount.
  • [GraphQL API] Product variant info now includes availability information. Since the list of availability per sales channel can get quite big there is a support for pagination and inclusion and exclusion of sales channels.

We extended the GraphQL schema:

extend type DiscountCode {
"""
How many times this discount code was applied
(only applications that were part of a successful checkout are considered)
"""
applicationCount: Long!
}
extend type ProductVariant {
availability: ProductVariantAvailabilityWithChannels
}
type ProductVariantAvailabilityWithChannels {
noChannel: ProductVariantAvailability
channels(
""""
The IDs of channels to include.
If neither `includeChannelIds` nor `excludeChannelIds` are provided, then all channels are returned.
"""
includeChannelIds: [String!],
"""
The IDs of channels to exclude.
If neither `includeChannelIds` nor `excludeChannelIds` are provided, then all channels are returned.
"""
excludeChannelIds: [String!],
limit: Int,
offset: Int): ProductVariantAvailabilitiesResult
}
type ProductVariantAvailability {
isOnStock: Boolean!
restockableInDays: Int
availableQuantity: Long
}
type ProductVariantAvailabilitiesResult {
limit: Int
offset: Int
total: Int!
results: [ProductVariantAvailabilityWithChannel!]!
}
type ProductVariantAvailabilityWithChannel {
channelRef: Reference!
channel: Channel!
availability: ProductVariantAvailability!
}