Skip to main content
Version: 3.x

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
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!]
}

Fields

id (ID!)

privateMetadata ([MetadataItem!]!)

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

privateMetafield (String)

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

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

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.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

metadata ([MetadataItem!]!)

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

metafield (String)

A single key from public metadata.

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

metafields (Metadata)

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

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

name (String)

code (String!)

usageLimit (Int)

used (Int!)

startDate (DateTime!)

endDate (DateTime)

applyOncePerOrder (Boolean!)

applyOncePerCustomer (Boolean!)

onlyForStaff (Boolean!)

minCheckoutItemsQuantity (Int)

categories (CategoryCountableConnection)

List of categories this voucher applies to.

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

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

Return the first n elements from the list.

Return the last n elements from the list.

collections (CollectionCountableConnection)

List of collections this voucher applies to.

Requires one of the following permissions: MANAGE_DISCOUNTS.

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

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

Return the first n elements from the list.

Return the last n elements from the list.

products (ProductCountableConnection)

List of products this voucher applies to.

Requires one of the following permissions: MANAGE_DISCOUNTS.

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

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

Return the first n elements from the list.

Return the last n elements from the list.

variants (ProductVariantCountableConnection)

List of product variants this voucher applies to.

Added in Saleor 3.1.

Requires one of the following permissions: MANAGE_DISCOUNTS.

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

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

Return the first n elements from the list.

Return the last n elements from the list.

countries ([CountryDisplay!])

List of countries available for the shipping voucher.

translation (VoucherTranslation)

Returns translated voucher fields for the given language code.

A language code to return the translation for voucher.

discountValueType (DiscountValueTypeEnum!)

Determines a type of discount for voucher - value or percentage

discountValue (Float)

Voucher value.

currency (String)

Currency code for voucher.

minSpent (Money)

Minimum order value to apply voucher.

type (VoucherTypeEnum!)

Determines a type of voucher.

channelListings ([VoucherChannelListing!])

List of availability in channels for the voucher.

Requires one of the following permissions: MANAGE_DISCOUNTS.

Interfaces

Node

An object with an ID

ObjectWithMetadata