Voucher Object
Vouchers allow giving discounts to particular customers on categories, collections or specific products. They can be used during checkout by providing valid voucher codes.
type Voucher implements Node & ObjectWithMetadata {
id: ID!
privateMetadata: [MetadataItem!]!
privateMetafield(key: String!): String
privateMetafields(keys: [String!]): Metadata
metadata: [MetadataItem!]!
metafield(key: String!): String
metafields(keys: [String!]): Metadata
name: String
externalReference: String
codes(before: String, after: String, first: Int, last: Int): VoucherCodeCountableConnection
code: String
usageLimit: Int
used: Int!
startDate: DateTime!
endDate: DateTime
applyOncePerOrder: Boolean!
applyOncePerCustomer: Boolean!
singleUse: Boolean!
onlyForStaff: Boolean!
minCheckoutItemsQuantity: Int
categories(before: String, after: String, first: Int, last: Int): CategoryCountableConnection
collections(before: String, after: String, first: Int, last: Int): CollectionCountableConnection
products(before: String, after: String, first: Int, last: Int): ProductCountableConnection
variants(before: String, after: String, first: Int, last: Int): ProductVariantCountableConnection
countries: [CountryDisplay!]
translation(languageCode: LanguageCodeEnum!): VoucherTranslation
discountValueType: DiscountValueTypeEnum!
discountValue: Float
currency: String
minSpent: Money
type: VoucherTypeEnum!
channelListings: [VoucherChannelListing!]
}
Interfaces
Fields
id
id · ID!
The ID of the voucher.
privateMetadata
privateMetadata · [MetadataItem!]!
List of private metadata items. Requires staff permissions to access.
privateMetafield
privateMetafield · String
A single key from private metadata. Requires staff permissions to access.
Tip: Use GraphQL aliases to fetch multiple keys.
key
key · String!
privateMetafields
privateMetafields · Metadata
Private metadata. Requires staff permissions to access. Use keys to control which fields you want to include. The default is to include everything.
keys
keys · [String!]
metadata
metadata · [MetadataItem!]!
List of public metadata items. Can be accessed without permissions.
metafield
metafield · String
A single key from public metadata.
Tip: Use GraphQL aliases to fetch multiple keys.
key
key · String!
metafields
metafields · Metadata
Public metadata. Use keys to control which fields you want to include. The default is to include everything.
keys
keys · [String!]
name
name · String
The name of the voucher.
externalReference
externalReference · String
External ID of this voucher.
Added in Saleor 3.23codes
codes · VoucherCodeCountableConnection
List of codes available for this voucher.
Added in Saleor 3.18before
before · String
Return the elements in the list that come before the specified cursor.
after
after · String
Return the elements in the list that come after the specified cursor.
first
first · Int
Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
last
last · Int
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
code
code · String
The code of the voucher.
usageLimit
usageLimit · Int
The number of times a voucher can be used.
used
used · Int!
Usage count of the voucher.
startDate
startDate · DateTime!
The start date and time of voucher.
endDate
endDate · DateTime
The end date and time of voucher.
applyOncePerOrder
applyOncePerOrder · Boolean!
Determine if the voucher should be applied once per order. If set to True, the voucher is applied to a single cheapest eligible product in checkout.
applyOncePerCustomer
applyOncePerCustomer · Boolean!
Determine if the voucher usage should be limited to one use per customer.
singleUse
singleUse · Boolean!
Determine if the voucher codes can be used once or multiple times.
Added in Saleor 3.18onlyForStaff
onlyForStaff · Boolean!
Determine if the voucher is available only for staff members.
minCheckoutItemsQuantity
minCheckoutItemsQuantity · Int
Determine minimum quantity of items for checkout.
categories
categories · CategoryCountableConnection
List of categories this voucher applies to.
before
before · String
Return the elements in the list that come before the specified cursor.
after
after · String
Return the elements in the list that come after the specified cursor.
first
first · Int
Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
last
last · Int
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
collections
collections · CollectionCountableConnection
List of collections this voucher applies to.
before
before · String
Return the elements in the list that come before the specified cursor.
after
after · String
Return the elements in the list that come after the specified cursor.
first
first · Int
Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
last
last · Int
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
products
products · ProductCountableConnection
List of products this voucher applies to.
before
before · String
Return the elements in the list that come before the specified cursor.
after
after · String
Return the elements in the list that come after the specified cursor.
first
first · Int
Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
last
last · Int
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
variants
variants · ProductVariantCountableConnection
List of product variants this voucher applies to.
before
before · String
Return the elements in the list that come before the specified cursor.
after
after · String
Return the elements in the list that come after the specified cursor.
first
first · Int
Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
last
last · Int
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
countries
countries · [CountryDisplay!]
List of countries available for the shipping voucher.
translation
translation · VoucherTranslation
Returns translated voucher fields for the given language code.
languageCode
languageCode · LanguageCodeEnum!
A language code to return the translation for voucher.
discountValueType
discountValueType · DiscountValueTypeEnum!
Determines a type of discount for voucher - value or percentage
discountValue
discountValue · Float
Voucher value.
currency
currency · String
Currency code for voucher.
minSpent
minSpent · Money
Minimum order value to apply voucher.
type
type · VoucherTypeEnum!
Determines a type of voucher.
channelListings
channelListings · [VoucherChannelListing!]
List of availability in channels for the voucher.
Used by
- Checkout (objects)
- VoucherAddCatalogues (objects)
- VoucherChannelListingUpdate (objects)
- VoucherCountableEdge (objects)
- VoucherCreate (objects)
- VoucherCreated (objects)
- VoucherDelete (objects)
- VoucherDeleted (objects)
- VoucherMetadataUpdated (objects)
- VoucherRemoveCatalogues (objects)
- VoucherTranslatableContent (objects)
- VoucherTranslate (objects)
- VoucherUpdate (objects)
- VoucherUpdated (objects)
- voucher (queries)
- Order (objects)
Schema: Saleor 3.23.43. Download SDL.