Skip to main content

Voucher

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
code: String!
usageLimit: Int
used: Int!
startDate: DateTime!
endDate: DateTime
applyOncePerOrder: Boolean!
applyOncePerCustomer: Boolean!
onlyForStaff: Boolean!
minCheckoutItemsQuantity: Int
categories(
before: String
after: String
first: Int
last: Int
): CategoryCountableConnection
countries: [CountryDisplay!]
translation(languageCode: LanguageCodeEnum!): VoucherTranslation
discountValueType: DiscountValueTypeEnum!
discountValue: Float
currency: String
minSpent: Money
type: VoucherTypeEnum!
}

Fields

Voucher.id ● ID! non-null scalar

Voucher.privateMetadata ● [MetadataItem!]! non-null object

List of private metadata items. Requires staff permissions to access.

Voucher.privateMetafield ● String scalar

A single key from private metadata. Requires staff permissions to access.

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3
This API is currently in Feature Preview and can be subject to changes at later point.
Voucher.privateMetafield.key ● String! non-null scalar

Voucher.privateMetafields ● Metadata scalar

Private metadata. Requires staff permissions to access. Use keys to control which fields you want to include. The default is to include everything.

Added in Saleor 3.3
This API is currently in Feature Preview and can be subject to changes at later point.
Voucher.privateMetafields.keys ● [String!] list scalar

Voucher.metadata ● [MetadataItem!]! non-null object

List of public metadata items. Can be accessed without permissions.

Voucher.metafield ● String scalar

A single key from public metadata.

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3
This API is currently in Feature Preview and can be subject to changes at later point.
Voucher.metafield.key ● String! non-null scalar

Voucher.metafields ● Metadata scalar

Public metadata. Use keys to control which fields you want to include. The default is to include everything.

Added in Saleor 3.3
This API is currently in Feature Preview and can be subject to changes at later point.
Voucher.metafields.keys ● [String!] list scalar

Voucher.name ● String scalar

Voucher.code ● String! non-null scalar

Voucher.usageLimit ● Int scalar

Voucher.used ● Int! non-null scalar

Voucher.startDate ● DateTime! non-null scalar

Voucher.endDate ● DateTime scalar

Voucher.applyOncePerOrder ● Boolean! non-null scalar

Voucher.applyOncePerCustomer ● Boolean! non-null scalar

Voucher.onlyForStaff ● Boolean! non-null scalar

Voucher.minCheckoutItemsQuantity ● Int scalar

Voucher.categories ● CategoryCountableConnection object

List of categories this voucher applies to.

Voucher.categories.before ● String scalar

Return the elements in the list that come before the specified cursor.

Voucher.categories.after ● String scalar

Return the elements in the list that come after the specified cursor.

Voucher.categories.first ● Int scalar

Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

Voucher.categories.last ● Int scalar

Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

Voucher.countries ● [CountryDisplay!] list object

List of countries available for the shipping voucher.

Voucher.translation ● VoucherTranslation object

Returns translated voucher fields for the given language code.

Voucher.translation.languageCode ● LanguageCodeEnum! non-null enum

A language code to return the translation for voucher.

Voucher.discountValueType ● DiscountValueTypeEnum! non-null enum

Determines a type of discount for voucher - value or percentage

Voucher.discountValue ● Float scalar

Voucher value.

Voucher.currency ● String scalar

Currency code for voucher.

Voucher.minSpent ● Money object

Minimum order value to apply voucher.

Voucher.type ● VoucherTypeEnum! non-null enum

Determines a type of voucher.

Interfaces

Node interface

An object with an ID

ObjectWithMetadata interface

Member of

Order object


Was this page helpful?