Skip to main content

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

Fields

Voucher.id ● ID! non-null scalar miscellaneous

The ID of the voucher.

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

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

Voucher.privateMetafield ● String scalar miscellaneous

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

Tip: Use GraphQL aliases to fetch multiple keys.

Voucher.privateMetafield.key ● String! non-null scalar miscellaneous

Voucher.privateMetafields ● Metadata scalar miscellaneous

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

Voucher.privateMetafields.keys ● [String!] list scalar miscellaneous

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

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

Voucher.metafield ● String scalar miscellaneous

A single key from public metadata.

Tip: Use GraphQL aliases to fetch multiple keys.

Voucher.metafield.key ● String! non-null scalar miscellaneous

Voucher.metafields ● Metadata scalar miscellaneous

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

Voucher.metafields.keys ● [String!] list scalar miscellaneous

Voucher.name ● String scalar miscellaneous

The name of the voucher.

Voucher.codes ● VoucherCodeCountableConnection object discounts

List of codes available for this voucher.

Added in Saleor 3.18
Voucher.codes.before ● String scalar miscellaneous

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

Voucher.codes.after ● String scalar miscellaneous

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

Voucher.codes.first ● Int scalar miscellaneous

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.codes.last ● Int scalar miscellaneous

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.code ● String scalar miscellaneous

The code of the voucher.This field will be removed in Saleor 4.0.

Voucher.usageLimit ● Int scalar miscellaneous

The number of times a voucher can be used.

Voucher.used ● Int! non-null scalar miscellaneous

Usage count of the voucher.

Voucher.startDate ● DateTime! non-null scalar miscellaneous

The start date and time of voucher.

Voucher.endDate ● DateTime scalar miscellaneous

The end date and time of voucher.

Voucher.applyOncePerOrder ● Boolean! non-null scalar miscellaneous

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.

Voucher.applyOncePerCustomer ● Boolean! non-null scalar miscellaneous

Determine if the voucher usage should be limited to one use per customer.

Voucher.singleUse ● Boolean! non-null scalar miscellaneous

Determine if the voucher codes can be used once or multiple times.

Added in Saleor 3.18
This API is currently in Feature Preview and can be subject to changes at later point.

Voucher.onlyForStaff ● Boolean! non-null scalar miscellaneous

Determine if the voucher is available only for staff members.

Voucher.minCheckoutItemsQuantity ● Int scalar miscellaneous

Determine minimum quantity of items for checkout.

Voucher.categories ● CategoryCountableConnection object products

List of categories this voucher applies to.

Voucher.categories.before ● String scalar miscellaneous

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

Voucher.categories.after ● String scalar miscellaneous

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

Voucher.categories.first ● Int scalar miscellaneous

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 miscellaneous

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.collections ● CollectionCountableConnection object products

List of collections this voucher applies to.

Requires MANAGE_DISCOUNTSpermission.
Voucher.collections.before ● String scalar miscellaneous

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

Voucher.collections.after ● String scalar miscellaneous

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

Voucher.collections.first ● Int scalar miscellaneous

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.collections.last ● Int scalar miscellaneous

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.products ● ProductCountableConnection object products

List of products this voucher applies to.

Requires MANAGE_DISCOUNTSpermission.
Voucher.products.before ● String scalar miscellaneous

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

Voucher.products.after ● String scalar miscellaneous

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

Voucher.products.first ● Int scalar miscellaneous

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.products.last ● Int scalar miscellaneous

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.variants ● ProductVariantCountableConnection object products

List of product variants this voucher applies to.

Requires MANAGE_DISCOUNTSpermission.
Voucher.variants.before ● String scalar miscellaneous

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

Voucher.variants.after ● String scalar miscellaneous

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

Voucher.variants.first ● Int scalar miscellaneous

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.variants.last ● Int scalar miscellaneous

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 miscellaneous

List of countries available for the shipping voucher.

Voucher.translation ● VoucherTranslation object discounts

Returns translated voucher fields for the given language code.

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

A language code to return the translation for voucher.

Voucher.discountValueType ● DiscountValueTypeEnum! non-null enum discounts

Determines a type of discount for voucher - value or percentage

Voucher.discountValue ● Float scalar miscellaneous

Voucher value.

Voucher.currency ● String scalar miscellaneous

Currency code for voucher.

Voucher.minSpent ● Money object miscellaneous

Minimum order value to apply voucher.

Voucher.type ● VoucherTypeEnum! non-null enum discounts

Determines a type of voucher.

Voucher.channelListings ● [VoucherChannelListing!] list object discounts

List of availability in channels for the voucher.

Requires MANAGE_DISCOUNTSpermission.

Interfaces

Node interface miscellaneous

An object with an ID

ObjectWithMetadata interface miscellaneous

Returned By

voucher query

Member Of

Checkout object ● Order object ● VoucherAddCatalogues object ● VoucherChannelListingUpdate object ● VoucherCountableEdge object ● VoucherCreate object ● VoucherCreated object ● VoucherDelete object ● VoucherDeleted object ● VoucherMetadataUpdated object ● VoucherRemoveCatalogues object ● VoucherTranslatableContent object ● VoucherTranslate object ● VoucherUpdate object ● VoucherUpdated object