You can now set Promotions in Crystallize via the Shop API. Learn more about what a promotion entails. Note that you can also set up promotions in the Crystallize App itself.
Let’s start off with looking at a mutation, followed by going deeper into each of the fields in the mutation:
mutation CreatePromotion {
setPromotions(
input: {
identifier: "summer_sale_2024"
name: "Summer Sale 2024"
description: "Get amazing discounts on summer essentials!"
periods: [
{ start: "2024-06-01T00:00:00Z", end: "2024-08-31T23:59:59Z" }
]
triggers: {
minValue: 50.00
customerGroups: ["crystal_customers"]
}
targets: {
topics: ["summer_wear"]
exclusions: { skus: ["beach-shorts-blue", "beach-shorts-white"] }
}
limitations: {
maxUsage: 1000
maxUsagePerCustomer: 2
cumulativeDiscount: false
repeatable: true
}
mechanism: {
type: Percentage
value: 20.0
}
}
) {
identifier
name
description
# Add other fields you want to return after creation
}
}mutation CreatePromotion {
setPromotions(
input: {
identifier: "summer_sale_2024"
name: "Summer Sale 2024"
description: "Get amazing discounts on summer essentials!"
periods: [
{ start: "2024-06-01T00:00:00Z", end: "2024-08-31T23:59:59Z" }
]
triggers: {
minValue: 50.00
customerGroups: ["crystal_customers"]
}
targets: {
topics: ["summer_wear"]
exclusions: { skus: ["beach-shorts-blue", "beach-shorts-white"] }
}
limitations: {
maxUsage: 1000
maxUsagePerCustomer: 2
cumulativeDiscount: false
repeatable: true
}
mechanism: {
type: Percentage
value: 20.0
}
}
) {
identifier
name
description
# Add other fields you want to return after creation
}
}Required field to specify the identifier of the promotion in Crystallize.
This is an optional field for providing the name of the promotion.
Another optional field to add a description for your promotion.
An array of periods a promotion should be valid for. Has two fields within it:
If unspecified, the promotion will take effect immediately and is permanent until modified or deleted.
A mechanism is there for you to specify the type of discount you would like to apply. It takes in two values: type and value. Value is always a floating point number but type can be one of the following:
This is a list of conditions that will trigger the promotion to be applied to a cart. It can be one or more of the following:
You have triggers to specify conditions for when a promotion is to be applied. Targets are there to know which item(s) the promotion should be applied to. It shares some similar fields with triggers such as:
You might want to add some limitations to your promotions, and that is exactly what the limitations field does. You can have limitations based on the following: