Available Helpers
Default Value
Learn how to use the default value helper function to handle empty values in shortcodes
The default
helper function allows you to specify a fallback value when a shortcode field is empty. This ensures your emails always display something meaningful, even when data is missing.
Syntax
The syntax for this helper function is:
Where:
default
is the function nameshortcode_value
is the primary value you want to displayfallback_default_value
is what will be displayed if theshortcode_value
is empty
Examples
Using a String Fallback
If lead.full_name
exists:
If lead.full_name
is empty:
Using Another Shortcode as Fallback
If company.contact_phone
exists:
If company.contact_phone
is empty:
Best Practices
- Always use default values for critical personalization fields
- Keep default values generic but professional
- Test your templates with both filled and empty fields
- Consider using other shortcodes as fallbacks when appropriate
- Preview your templates to ensure the fallbacks work as expected
Was this page helpful?