docs
  1. SCAYLE Resource Center
  2. User Guide
  3. Shops
  4. Promotions
  5. Tutorials
  6. Discount specific items when minimum order value is reached

Discount specific items when minimum order value is reached

Minimum order value promotions in eCommerce are valuable for several reasons:

  • They increase the average order value by encouraging customers to spend more in a single transaction.
  • These promotions can improve profit margins and reduce shipping costs.
  • They enhance customer loyalty, providing an edge in a competitive market and offering opportunities for data collection and personalization.
  • Minimum order value promotions can be used for upselling, cross-selling, and as a marketing tool to attract and retain customers, all while creating a sense of achievement for customers who reach the promotion's requirements.

In the following sections, you will learn how to run a typical minimum order value promotion, which discounts specific items once a threshold is reached.

Creating the promotion

To create and run a buy x get y promotion, consult your account manager in order to activate the config sellable_for_free. This config is deactivated by default for safety reasons, in order to avoid selling items for free by mistake.

We will create the promotion using the advanced view of the SCAYLE Panel.

  • Select the Shop where you want to create your promotion and navigate to Discounts & Offers > Promotions.
  • Click the + New Advanced Promotion Button on top right corner of the overview table.

Now, we will fill out the promotion fields like so:

FieldValueDescription
NameMOV SaleThe name will later on be exposed via the Storefront API, so you can use it for instance, to show it in the storefront. “MOV Sale” sounds suitable for our case
Promotion TypeAutomatic discountWe want to discount specific items relatively, so automatic discount is the effect we need to use
Start Date11.11.23 00:00We we are running the promotion for one week
End Date18.11.23 23:59We we are running the promotion for one week
Priority1We will run only one promotion at the same time, so the priority is not relevant for us. We just put in 1
CombinableNoneWe will run only one promotion at the same time, so we do not have to configure Combinability
CountriesGermanySpecify, in which shop-country the promotion is valid. In our case, we will run it in Germany only
AudiencesnoneThe promotion is only valid for all customers
Discount typepercentageIt is set to “percentage” because we want to discount the items relatively
Discount amount10As we want to reduce specific items by 10%, we have to set the value to 10
Global conditions and keykey: mov condition: payload.totals.withTaxWithoutVoucher > 12000The key is freely configurable, it has no direct impact, but it is exposed via the Storefront API and can be used e.g. as a translation string. The condition is set to “payload.totals.withTaxWithoutVoucher > 12000”, which is checking, whether the basket total is greater than 120€ without having a voucher applied
Item conditionsitem.variant.attributes.exists(a, a.key == 'mov' && a.value == 'true')We only want to discount specific items, which are identified by the Attribute Group mov and the value “true"

Click Save to finish.

Communicating the promotion

Every item that qualifies for a discount is identified by the Attribute Group “mov” being set to “true”. Highlighting which products in the Storefront that are eligible for the promotion is done via Attribute Group and is not part of the “Promotions” feature. (If you are interested in learning how to add Attribute Groups to your product and work with them in the frontend, refer to the Admin API Product Attributes documentation.)

Applying the promotion

Once you've identified which items are eligible for the discount, you can just send the promotionId within the request body of the POST /baskets/:id/items endpoint of the Storefront API. This will give us a request body like so:

{
  "variantId": 52132,
  "quantity": 1,
  "promotionId": "65438f563a404c7e45779f17"
}

Validating promotions

When a customer opens their basket, you want them to see discounted prices only if the overall promotion is valid. In this case, you can use the GET /baskets/:id/items endpoint. The response will then tell you whether the promotions within the basket are valid. An invalid promotion attached to an item would look like this:

{
  "key": "basketKey",
  ..
  "items": [
      {
          "key": "335f5352088d7d9bf74191e006d8e24c",
          "promotion": {
            "id": "65438f563a404c7e45779f17",
            "name": "MOV Sale",
            "isValid": false,
            "failedConditions": [
              {
                "key": "mov",
                "level": "global"
              }
            ]
          }
}]
}

Here the global condition “mov” is not valid, because the minimum order value has not yet been reached.

Summary

Here are the key facts you should remember from this tutorial:

  • MOV (minimum order value) promotions can be created via the SCAYLE Panel using the effect automatic discount.
  • Promotions can be fetched via the Storefront API in order to communicate them to customers.
  • Highlighting which products in the Storefront that are eligible for a promotion is done via Attribute Groups and is not part of the Promotions feature.
  • You can use the Storefront API basket endpoint to find out whether the promotion conditions are valid.