Articles on: Campaign and Automation

How to Use Default Values for Template Variables in ShopAgain

Introduction


Personalizing messages enhances user engagement and provides a customized experience. ShopAgain’s merge tags and variables facilitate this personalization in your marketing communications. This document will guide you on setting default values for these variables, ensuring there's always content even if a specific user field might be empty.

Why Use Default Values?


Occasionally, certain user fields might be empty. To prevent sending an incomplete or impersonal message, default values act as placeholders.

How to Implement Default Values


To use default values with ShopAgain's template variables, you'll employ the "pipe" (|) symbol followed by default: and then the fallback content you wish to use. Here's the general format:

{{ VariableName | default:"DefaultValue" }}


Please note, it's essential to use double quotes (") around the default value. Single quotes (') won't work.

Example:


For the FirstName variable:

Hey {{ FirstName | default:"there" }},

If the user's first name isn't available, the system will default to "Hey there," ensuring the message still feels personalized.

Additional Resources


For a comprehensive understanding of ShopAgain’s template variables/merge tags, refer to our detailed documentation: How to Use Variables/Merge Tags in the Email Template.


Conclusion


Using default values for template variables ensures your messages remain polished and personalized, regardless of missing user data. Always consider setting default values for key template variables to maintain consistent user communication.

Updated on: 17/08/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!