docs
  1. SCAYLE Resource Center
  2. Developer Guides
  3. Pricing & Promotions
  4. Promotions
  5. Automatic Discounts

Automatic Discounts

General

The customer receives a discount on specific items in the basket or order. The discount can be relative, such as 10%, or absolute such as 10€. You can narrow down the discount conditions to a specific audience or items.

Example

10% off of every sneaker, but only when customer is in the audience “VIP”. 15€ off of every item, which is more expensive than 200€. 10€ off of the cheapest/most expensive item in the basket

Required fields

To create an automatic discount following fields are at least required:

  • Name
  • Priority
  • Schedule Date
  • Discount value

Admin API

ParameterDetails
id READ-ONLY

String

Promotion id

version READ-ONLY

String

Promotion version

name

String

Name of the promotion

schedule

PromotionSchedule

Time range when the promotion is active

isActive

Boolean

Promotion active flag

shopId

String

The list of shop ids where the promotion takes place

companyId

String

The list of company ids where the promotion takes place

siblingPromotions

PromotionSiblingPromotions

Sibling promotions allow/block other promotions from being used together with this one

audiences

PromotionAudiences

Audiences allow/block list. Use it to restrict promotions to specific customer groups

effect

PromotionEffect

The effect that will be applied if all conditions are satisfied

globalConditions

PromotionGlobalCondition

The list of conditions ('payload.*') that determines whether the promotion is applicable or not

itemConditions

PromotionItemCondition

The list conditions ('item.*') that determine whether promotion is applicable or not for a particular item

priority

String

Priority of the promotion

additionalData

Object

Additional data of the promotion. Can be legal text or some other info, that will be shown to customer

tiers

PromotionTier

The list of promotion tiers. Tiers must be sent in ascending order

Create a Promotion

You can create promotions that are valid in a specific shop, countries or for a particular audience.

Method Signature

let response = await client.apis.Promotions.createPromotion({}, {requestBody: promotion});
let promotion = response.body;

Examples

Create Automatic Discount of 10%

JavaScript:
//create Automatic Discount - percentage: 10%
    let promotion = {
        name: "MyPromotion",
        schedule: {
            from: "2023-05-10T10:00:00+01:00",
            to: "2023-05-10T10:00:00+01:00"
        },
        isActive: true,
        shopId: ["1000"],
        companyId: "100",
        effect: {
            id: "automatic_discount",
            additionalData: {
                type: "percentage,
                value: 1000
            }
        },
        itemConditions: [
            {
                key: "mov_100",
                condition: "item.color == \"yellow\""
            }
        ]
    };

    let response = await client.apis.Promotions.createPromotion({}, {requestBody: promotion});
    promotion = response.body;

    console.log(promotion.id);

Create Automatic Discount of 20%


    //create Automatic Discount - absolute value: 20
    let promotion = {
        name: "MyPromotion",
        schedule: {
            from: "2023-05-10T10:00:00+01:00",
            to: "2023-05-10T10:00:00+01:00"
        },
        isActive: true,
        shopId: ["1000"],
        companyId: "100",
        effect: {
            id: "automatic_discount",
            additionalData: {
                type: "absolute",
                value: 20
            }
        },
        itemConditions: [
            {
                key: "mov_100",
                condition: "item.color == \"yellow\""
            }
        ]
    };

    let response = await client.apis.Promotions.createPromotion({}, {requestBody: promotion});
    promotion = response.body;

    console.log(promotion.id);

Update a Promotion

You can update promotion configuration such as schedule, effect, priority, etc.

Method Signature

let response = await client.apis.Promotions.updatePromotion({promotionId: promotionId}, {requestBody: promotion});
let promotion = response.body;

Example: Update a Promotion

let promotion = {
    name: "MyPromotion",
};

let response = await client.apis.Promotions.createPromotion({promotionId: "65688b0987f54332106a579e"}, {requestBody: promotion});
promotion = response.body;

console.log(promotion.name);

Storefront API

Get Promotions

Retrieve active promotions with matching ID using GET v1/promotions endpoint.

For details see the Storefront API Reference.

In the SCAYLE Panel

Create automatic discount

To create a new promotion:

  1. Select the Shop where you want to create your promotion and go to Promotions > Automatic Discount.
  2. Click the + New Automatic Discount button.
  3. In Name, type a name for the promotion.
  4. Priority: This determines the priority of the promotion in the case that there are multiple promotions active at the same time.
  5. Select whether the promotion should be combinable with other promotions.
    • If selected, enter Combinable promotion IDs in the Allowlist or Blocklist
  6. In Countries, select in which countries of the current shop the promotion should be valid.
  7. In Audiences, select for which customer audience the promotion should be valid.
  8. (Optional) In Combinable, select which promotions are allowed or blocked for combination.
  9. Enter further criteria based on the discount type:
    • For type Automatic Discount, enter Discount type and Discount amount.
  10. Add at least one condition to the promotion. See conditions below.
  11. Start date: enter the date and time when the promotion starts running.
  12. End date: enter the date and time when the promotion becomes inactive.
  13. Click Save.

Automatic Discount

Result
The automatic discount will be applied to any products by default. If needed you can change the applies to selected products, categories or attributes.