Skip to main content

Shopify Flow trigger (Loyalty)

Updated over a week ago

Loyalty Flow Trigger Help Document

This document outlines the fields available in the Loyalty flow trigger and how to reference them in your workflows. The flow trigger allows you to work with customer loyalty points and related details.


Available Fields

  1. Points

    • Field Type: number_decimal

    • Key: Points

    • Usage:
      The number of loyalty points earned.
      Example: {{points}}

  2. Earn Rule ID

    • Field Type: number_decimal

    • Key: Earn Rule ID

    • Usage:
      The ID of the earning activity or rule that triggered the loyalty points.
      Example: {{earnRuleId}}

  3. Note

    • Field Type: single_line_text_field

    • Key: Note

    • Usage:
      Any additional context or notes regarding the activity.
      Example: {{note}}

  4. Customer Loyalty Details

    • Field Type: schema.CustomerLoyaltyDetails

    • Key: Customer Loyalty Details

    • Usage:
      Full details of the customer’s loyalty status.
      Example: {{customerLoyaltyDetails}}

      • Nested Fields:

        • {{customerLoyaltyDetails.availablePoints}}
          The total available points for the customer.

        • {{customerLoyaltyDetails.pendingPoints}}
          Points that are pending or not yet confirmed.

        • {{customerLoyaltyDetails.creditedPoints}}
          Points that have been credited to the customer's account.

        • {{customerLoyaltyDetails.spentAmount}}
          The total amount spent by the customer in the loyalty program.

        • {{customerLoyaltyDetails.currentVipTier}}
          The customer's current VIP tier or loyalty level.

        • {{customerLoyaltyDetails.referredCompleted}}
          The number of referrals the customer has successfully completed.

        • {{customerLoyaltyDetails.referralLink}}
          The referral link provided to the customer.

        • {{customerLoyaltyDetails.dob}}
          The customer's date of birth.

  5. Social Media Rewards

    • Field Type: Boolean

    • Nested Fields:

      • {{customerLoyaltyDetails.rewardedForFacebook}}
        Indicates if the customer earned points for engaging on Facebook.

      • {{customerLoyaltyDetails.rewardedForTwitter}}
        Indicates if the customer earned points for engaging on Twitter.

      • {{customerLoyaltyDetails.rewardedForInstagram}}
        Indicates if the customer earned points for engaging on Instagram.

      • {{customerLoyaltyDetails.rewardedForYoutube}}
        Indicates if the customer earned points for engaging on YouTube.

      • {{customerLoyaltyDetails.rewardedForTiktok}}
        Indicates if the customer earned points for engaging on TikTok.

      • {{customerLoyaltyDetails.rewardedForNewsLetter}}
        Indicates if the customer earned points for subscribing to a newsletter.

      • {{customerLoyaltyDetails.rewardedForSms}}
        Indicates if the customer earned points for receiving SMS communications.

      • {{customerLoyaltyDetails.rewardedForCreatingAccount}}
        Indicates if the customer earned points for creating an account.

  6. Customer Rewards

    • Field Type: CustomerReward[]

    • Usage:
      This field contains the customer’s rewards information.
      Example: {{customerLoyaltyDetails.rewards}}

      • Nested Fields:

        • {{customerLoyaltyDetails.rewards[0].description}}
          The description of the reward.

        • {{customerLoyaltyDetails.rewards[0].pointTransactionId}}
          The ID of the transaction that awarded the points.

        • {{customerLoyaltyDetails.rewards[0].pointRedeemRuleId}}
          The rule ID that was used for redeeming the points.

        • {{customerLoyaltyDetails.rewards[0].discountCode}}
          The discount code associated with the reward.

        • {{customerLoyaltyDetails.rewards[0].usedAt}}
          The date and time when the reward was used.

        • {{customerLoyaltyDetails.rewards[0].orderId}}
          The order ID related to the reward redemption.

        • {{customerLoyaltyDetails.rewards[0].orderName}}
          The name or description of the order.

        • {{customerLoyaltyDetails.rewards[0].status}}
          The current status of the reward (USED, UNUSED, REFUNDED).

        • {{customerLoyaltyDetails.rewards[0].createAt}}
          The date when the reward was created.

        • {{customerLoyaltyDetails.rewards[0].expireDate}}
          The expiration date of the reward.

        • {{customerLoyaltyDetails.rewards[0].variantId}}
          The product variant ID related to the reward.


Using Loops with Rewards

If you want to loop through the rewards and display each reward's description or other details, you can use the following loop syntax:

liquidCopy{% for rewards_item in customerLoyaltyDetails.rewards %} {{ rewards_item.description }} {% endfor %}

This loop will iterate over each reward in the customer's rewards list and display the description of each reward.

You can also access other fields within the loop, such as:

liquidCopy{% for rewards_item in customerLoyaltyDetails.rewards %} Reward Description: {{ rewards_item.description }} Points Transaction ID: {{ rewards_item.pointTransactionId }} Discount Code: {{ rewards_item.discountCode }} {% endfor %}

How to Use These Fields

You can reference these fields in your workflows using the variable names enclosed in double curly braces (e.g., {{points}}). For nested fields, use dot notation to access specific subfields (e.g., {{customerLoyaltyDetails.availablePoints}} or {{customerLoyaltyDetails.rewards[0].description}}). To loop through rewards, use the provided syntax.

Did this answer your question?