Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
query getSanityRewards {
  RewardList(id: "reward-list-singleton") {
    rewardCategories {
      _id
      label {
        en
      }
      rewards {
        ... on Reward {
          # Sanity ID of the reward
          _id
          # Loyalty Engine ID to be used in the Loyalty Engine query if needed
          loyaltyEngineId
          # Reward content to display to the user (name, image, description...)
          name {
            en
          }
          image {
            en {
              asset {
                url
              }
            }
          }
          description {
            enRaw
          }
          # Here we add the rules we want to check for the rewards
          # ej:e.g., LoyaltyPoints (reward points cost), RewardPrice (reward money price),
          # SubtotalSpend (minimum subototal to spend for redeeming the reward)
          ruleSet {
            ... on LoyaltyPoints {
              points
            }
            ... on RewardPrice {
              price
            }
            ... on SubtotalSpend {
              minimumSpend
            }
          }
          # Benefit of the reward, it can be either a Combo, Item, OfferDiscount
          # or Picker
          # ej:e.g., OfferDiscount (It can be a discount for the whole cart or 
          # a discount for a specific product)
          incentives {
            ... on OfferDiscount {
              discountType
              discountValue
              discountProduct {
                ... on Item {
                  name {
                    en
                  }
                }
                ... on Combo {
                  name {
                    en
                  }
                }
              }
            }
          }
          # Reward redemption method available
          redemptionMethod
          # Here we can get the needed PLUs by looking for a specific vendor
          # ej:e.g., Partner constant PLU
          vendorConfigs {
            partner {
              _type
              constantPlu
              pluType
            }
          }
        }
      }
    }
  }
}

...