Paid Memberships Pro v3.7+ supports Liquid-style template syntax in email templates. This lets you add conditional logic and text formatting directly in your email content without writing PHP code.

Liquid syntax works alongside the existing {{ variable }} placeholders you already use in your email templates.

Output Tags

Use double curly braces {{ }} to output a variable’s value with optional formatting:

{{ variable_name }}
{{ variable_name | filter }}

Available Variables

Output tags can reference any of the standard PMPro email template variables. Use the variable name without the !! wrapper. Global variables (listed below) can be used in any email template. Refer to the docs for the specific email you want to customize for a list of template-specific variables.

Variable Description
{{ sitename }} The name of the site.
{{ siteemail }} The email address of the site.
{{ site_url }} The URL of the site.
{{ levels_url }} The URL of the page where users can view available membership levels.
{{ login_url }} The URL of the login page.
{{ pmpro_from_email }} The "From Email" set in Memberships > Settings > Email Settings.
{{ wordpress_admin_email }} The "Administration Email Address" set in Settings > General.
{{ header_name }} The name of the email recipient.

Output tags also support user meta fields. If a variable name doesn’t match a known email variable, PMPro automatically looks it up as user meta for the member receiving the email.

{{ company_name }}
{{ phone_number }}

Available Filters in Liquid Syntax

Liquid Syntax Filters modify the output of a variable. Chain them with a pipe | character:

FilterDescriptionExample
upcaseConverts text to UPPERCASE{{ name | upcase }}
downcaseConverts text to lowercase{{ name | downcase }}
stripRemoves leading and trailing whitespace{{ name | strip }}
defaultProvides a fallback value when the variable is empty{{ discount_code | default: "No discount applied" }}

Filter Examples

Welcome, {{ name | upcase }}!

Output: Welcome, JASON COLEMAN!

Discount code used: {{ discount_code | default: "No discount applied" }}

Output when no discount: Discount code used: No discount applied

Conditional Logic

Use {% if %} tags to show or hide sections of your email based on variable values.

Basic If/Else

{% if discount_code %}
  You saved with discount code: {{ discount_code }}
{% else %}
  No discount code was applied to this order.
{% endif %}

If/Elsif/Else

{% if membership_level_name == "Gold" %}
  Welcome to our Gold membership! You have access to all content.
{% elsif membership_level_name == "Silver" %}
  Welcome to Silver! Upgrade to Gold for full access.
{% else %}
  Thanks for joining! Check out our membership options.
{% endif %}

Comparison Operators

OperatorDescriptionExample
==Equal to{% if membership_level_name == "Gold" %}
!=Not equal to{% if discount_code != "" %}
>Greater than{% if order_total_raw > 100 %}
<Less than{% if order_total_raw < 50 %}
>=Greater than or equal to{% if order_total_raw >= 100 %}
<=Less than or equal to{% if order_total_raw <= 50 %}

Boolean Operators

Combine conditions with and / or:

{% if membership_level_name == "Gold" and order_total_raw > 100 %}
  Thank you for your premium purchase!
{% endif %}
{% if discount_code or order_total_raw < 25 %}
  Great deal!
{% endif %}

Checking for Empty Values

Use the empty keyword to check if a variable has no value:

{% if company_name != empty %}
  Company: {{ company_name }}
{% endif %}

Truthy Checks

You can check if a variable has any value (is "truthy") without a comparison operator:

{% if discount_code %}
  Discount applied: {{ discount_code }}
{% endif %}

This block renders if discount_code has any non-empty value.

Where to Use Liquid Syntax

Liquid syntax can be used in the email body of any PMPro email template. Edit your templates at Memberships > Settings > Email Templates, select a template, and add Liquid syntax directly in the body editor.

Syntax Reference Panel

The email template editor includes a collapsible Advanced Email Template Logic panel that provides a quick reference for Liquid syntax, filters, and conditionals while you're editing.

Screenshot of the advanced email template logic using liquid syntax

Common Use Cases

Personalized Welcome by Level

{% if membership_level_name == "Premium" %}
  <p>Welcome to Premium, {{ name }}! Here's how to access your exclusive content:</p>
  <ul>
    <li><a href="!!premium_content_url!!">Premium Library</a></li>
    <li><a href="!!community_url!!">Members-Only Community</a></li>
  </ul>
{% else %}
  <p>Welcome, {{ name }}! You're now a {{ membership_level_name }} member.</p>
{% endif %}

Show Custom User Fields

{% if company_name != empty %}
<p>Billing to: {{ company_name }}</p>
{% endif %}

Order Total Messaging

{% if order_total_raw > 0 %}
  <p>Your payment of {{ order_total }} has been processed.</p>
{% else %}
  <p>Your free membership is now active. No payment was required.</p>
{% endif %}

Tips and Best Practices

  • Test your templates. After adding Liquid syntax, send a test email to verify the output. Use the email template editor's "Send Test" feature.
  • Keep it simple. Liquid syntax is best for straightforward conditionals. For complex logic, consider using the pmpro_email_body filter in custom code instead.
  • Nesting is supported. You can nest {% if %} blocks inside other {% if %} blocks, but keep nesting shallow to maintain readability.
  • Liquid and !!variables!! work together. You can use both syntaxes in the same template. PMPro processes !!variable!! replacements and Liquid syntax independently.

Last updated on March 30, 2026


Was this article helpful?
YesNo