Adding a Freebie Condition with the Criteria Based Method (3.1)

Set the conditions to determine how freebies should be shared in the order based on the added products.

  • The first and priority condition is to distribute eight freebies in the first delivery for every certain 48 products added.

  • Freebies are distributed based on the filter, in this workshop, we give out products of the selected brand.

To create a priority Freebie Condition record:

  1. Go to the created Freebie Type record → click the Related tab → click New in the Freebie Condition section.

  2. Enter the following:

    • Freebie Condition Name: Certain Brand 48 + 8.

    • Delivery Control: select First to share freebies in the first delivery.

    • Order: specify 1 to apply this condition in priority order.

    • Set Active.

    • Condition Details: add this JSON, according to which the condition will trigger for the certain product or a product, which is not a promotional product, if the required number of such products is added to the order cart.

      • Insert this JSON

      • JSON with Comments

      Click to view
      {
         "levelConditions":{
            "operator":"AND",
            "productCount":{
               "filter":{
                  "operator":"AND",
                  "items":[
                     {
                        "field":"orders__PromotionId__c",
                        "operator":"equal",
                        "value":""
                     },
                     {
                        "field":"orders__ProductId__r.CTCPG__ParentId__r.CTCPG__ParentId__r.CTCPG__ParentId__r.CTCPG__ExternalId__c",
                        "operator":"equal",
                        "value":"40011"
                     }
                  ]
               },
               "minCount":1
            },
            "requiredProducts":{
               "productIdField":"orders__ProductId__c",
               "operator":"AND",
               "items":[
      
               ]
            }
         },
         "levelBasedOnFilter":{
            "operator":"AND",
            "items":[
               {
                  "field":"orders__PromotionId__c",
                  "operator":"equal",
                  "value":""
               },
               {
                  "field":"orders__ProductId__r.CTCPG__ParentId__r.CTCPG__ParentId__r.CTCPG__ParentId__r.CTCPG__ExternalId__c",
                  "operator":"equal",
                  "value":"40011"
               }
            ]
         }
      }
      Click to view
      {
         "levelConditions":{
            "operator":"AND",
            "productCount":{
               "filter":{
                  "operator":"AND",
                  "items":[
                     {
                        "field":"orders__PromotionId__c",
                        "operator":"equal",
                        "value":""
                     },
                     {
                        "field":"orders__ProductId__c",            // If the External Id is not set, use this notation.
                        "operator":"equal",
                        "value":"40011"                            // The code of the product.
                     }
                  ]
               },
               "minCount":1
            },
            "requiredProducts":{
               "productIdField":"orders__ProductId__c",
               "operator":"AND",
               "items":[
      
               ]
            }
         },
         "levelBasedOnFilter":{
            "operator":"AND",
            "items":[
               {
                  "field":"orders__PromotionId__c",
                  "operator":"equal",
                  "value":""
               },
               {
                  "field":"orders__ProductId__r.CTCPG__ParentId__r.CTCPG__ParentId__r.CTCPG__ParentId__r.CTCPG__ExternalId__c",    // If the External Id is set, use this notation.
                  "operator":"equal",
                  "value":"40011"                                                                                                  // The code of the product.
               }
            ]
         }
      }
    • Adding Method: select Criteria Based to set up a filter for freebies.

    • Criteria Details: add this condition to share a certain product as a freebie:

      WHERE CTCPG__ParentId__c = '40011'
      You may either specify CTCPG__ParentId__r.CTCPG__ExternalId__c or CTCPG__ParentId__c, depending on whether your products have External Id.
      Freebie Condition 1 3.1
  3. Click Save & New.

The priority Freebie Condition is created. Add the second one.

``