Emails and documents that use square brackets can fill in your customer's details and show or hide text depending on them. You type the instructions as ordinary text in the editor, inside [square brackets].
- Merge tags: putting a value in
- A fallback for a blank value
- Showing text only sometimes: if, else
- All the conditions
- Blocks inside blocks
- Examples
- Tips for the editor
- Mistakes and what they mean
- What it does not do
Merge tags: putting a value in
Write the name of a value in square brackets and it is replaced by the customer's own value when the email is sent.
Hi [firstname],
becomes
Hi Sam,
- Capital letters do not matter:
[FirstName]そして[firstname]are the same. - Only the names available for that email are filled in. Any other text in square brackets, such as a name that is not on the list or
[1], is left exactly as you typed it. Check that you have spelled the name the way the list shows it. - If the customer has no value for a name, it is replaced with nothing (or with your fallback, below).
- A name may have spaces in it, as some form fields do: a field called
first nameis written[first name]. Extra spaces and capital letters do not matter, so[First Name]is the same. Names with spaces also work in[if]:[if first name=Sam].
A fallback for a blank value
Add a bar | and the words to use when the value is empty:
Hi [firstname|there],
| The customer's first name is | The email says |
|---|---|
| Sam | Hi Sam, |
| (blank) | Hi there, |
Showing text only sometimes: if, else
Put the text between [if ...] そして [/if]. It is shown only when the condition is true.
[if paid]Thank you for your payment.[/if]
追加 [else] for the text to show when the condition is not true:
[if mlist_optin=1]You are subscribed to our newsletter.[else]You are not subscribed to our newsletter.[/if]
[else] is optional. You can also write [endif] instead of [/if].
For a short phrase there is a one-tag form. The three words then, else そして endif are reserved: they are what the tag is built from, and an else part is only valid when it starts with the word else. The else part is optional. Put each piece of text in double quotes or in curly brackets, and the quotes or brackets are not shown in the email:
[if mlist_optin=1 then "You are subscribed" else "You are not subscribed" endif]
[if mlist_optin=1 then {You are subscribed} else {You are not subscribed} endif]
[if paid then "Thank you" endif]
The first two give You are subscribed or You are not subscribed, with no quotes or brackets in the email. The third shows Thank you when paid is true, and nothing otherwise.
- Quotes or curly brackets? Either one. Quotes read more naturally. The editor may turn straight quotes into curly ones, and that is accepted. Use curly brackets
{ }when the text itself contains double quotes:{He said "hi"}. - Inside quotes or curly brackets the three reserved words are just text, so
"go somewhere else"is fine. Without quotes, the wordsthen,elseそしてendifcannot be part of what you show, so quote the text when it might contain them. - To show nothing when the condition is false, leave the
elsepart out:[if paid then "Thank you" endif]. To show nothing when it is true, leave the first part empty:[if paid then "" else "Please pay" endif](orthen {}). - Quotes are optional for simple text:
[if paid then Thanks else Please pay endif]also works. Text without quotes is shown as you typed it, so any quote marks in it are shown too. - Spaces just inside the quotes are kept (as one space), so
" (paid)"shows with a space before it. - Capital letters in the words
then,elseそしてendifdo not matter. - The text in an inline tag is plain text: bold, links and other formatting are dropped, and it cannot contain square brackets or
[name]tags. For anything longer, or with formatting or names inside it, use the block form above. - A missing
endif, a secondelse, or a quote that is never closed is reported as a mistake.
The block form, [if x] ... [else] ... [/if], also lets you leave the [else] out.
To show a tick or a cross:
[if mlist_optin=1]✓[else]✗[/if]
All the conditions
| Write | True when |
|---|---|
[if paid] |
the value is filled in and is not one of the false values below |
[if not phone] |
the value is blank or one of the false values below |
[if status=shipped] |
the value equals the word (capital letters ignored) |
[if status!=shipped] |
the value does not equal the word |
[if total>100] |
the value is a number greater than 100 |
[if total<100] |
the value is a number less than 100 |
[if total>=100] |
greater than or equal to 100 |
[if total<=100] |
less than or equal to 100 |
[if note contains parcel] |
the value has that word or phrase somewhere in it |
[if not note contains parcel] |
the opposite of any of the above: put not first |
False values. のために [if x] そして [if not x], these values all count as false, in any capital letters: blank, 0 (also 0.00), -1, f, n, no そして false. Anything else that is filled in is true, including 1, y, はい, true and any other word. (A value that is just the letter N, such as an initial, therefore counts as false.) The comparisons =, != and the rest look at the actual value, so [if x=false] is true only when the value is the word false.
- You do not need quotes around the word, but you may use them, which helps for a phrase with spaces:
[if note contains "front door"]. - Numbers are compared as numbers, so
1,250.50is greater than1000.>そして<only work on numbers; if either side is not a number the condition is false. =そして!=compare as numbers if both sides are numbers, otherwise as words.- A name that is not on the available list for that email, or a form field that was not filled in or a box that was not ticked, has no value.
[if name]is then false and[if not name]is true. So check the spelling of a name against the list: a misspelled name quietly counts as having no value.
Blocks inside blocks
An [if] can contain another [if], up to 10 deep. Each one needs its own [/if].
[if paid] Thank you for your payment. [if total>500]As a thank you, your next delivery is free.[/if] [else] Please pay by the due date. [/if]
There is no [else if]: put another [if] inside the [else]. There is also no そして or or: nest two blocks to mean "and", or use two separate blocks.
Examples
Greeting with a fallback and a note for unpaid orders
Hi [firstname|there], [if paid]Your payment has been received.[else]Your order is waiting for payment.[/if]
Ask for missing details
[if not phone]Please reply with a phone number so the courier can reach you.[/if]
Different wording for a delivery note
[if note contains "front door"]We will leave your parcel at the front door.[/if]
Tips for the editor
- Type the instructions as plain text. You can put
[if paid]そして[/if]on their own lines or inside a sentence. - If you put an instruction alone in its own paragraph, that paragraph is removed along with the instruction, so no blank gaps are left in the email.
- Do not worry about extra spaces, capital letters, or bold or coloured text inside the brackets: they are ignored. Curly quotes added by the editor work too.
- Send yourself a test email, using a customer who has the value and one who does not, before using a new email.
Mistakes and what they mean
When a template is checked, each mistake is reported with the line it is on:
| Message | 何をするか |
|---|---|
| [if] is never closed with [/if] | 追加 [/if] where the conditional text ends. Until you do, the [if] is shown in the email exactly as you typed it, together with the text after it, so nothing is hidden. (Ordinary words in square brackets, such as "[if applicable]", are treated the same way, and so is a condition that cannot be read.) |
| [/if] has no [if] before it | Remove the extra [/if], or add the missing [if]. |
| [else] has no [if] before it | Put [else] between an [if] and its [/if], or remove it. |
| a second [else] in the same [if] | An [if] has one [else] only. For another case, put a new [if] inside the [else]. |
| needs endif | A one-tag [if x then "abc" else "def" ...] must end with endif inside the same brackets. |
| has a second else | A one-tag [if] has one else. If the text itself has the word else in it, put the text in quotes. |
| has a quote that is not closed | A quote or a curly bracket was opened and never closed. Check that each " has its pair, or use { }. |
| has a { inside { } | Curly brackets cannot be nested. A closing } is probably missing; or use double quotes for the text. |
| [if] has no condition | Write what to test: [if paid]. |
| cannot read the condition | Use one of the forms in All the conditions. Names have letters, numbers, spaces, dots, dashes and underscores only. |
| uses and/or, which are not supported | There is no そして or or. Nest two [if] blocks to mean "and", or use two separate blocks. (A field whose own name contains the word "and", such as "terms and conditions", is fine when it is one of the names available for that email.) |
| [else if] is not supported | Put an [if] inside the [else]. |
| [if] blocks are nested more than 10 deep | Simplify the email. It is sent unchanged, with the instructions showing, until you do. |
Fix every message before using the email with customers: an email with mistakes can send text meant to be hidden.
What it does not do
- It cannot use values that are not on the available list for that email. This keeps other customers' and the shop's private details out of emails.
- It does not calculate, repeat lines or run code.
- A customer's own words are always shown as they typed them. If a customer's name is
[if x], that is what the email shows; it is never treated as an instruction.
More From This Section
FAQ Topics
The Basics
Building your site
- Pages
- Content Editor Modes Explained
- - DRAG DROP Editor (Default)
- - CONTENTBOX Editor (Advanced)
- - WORD STYLE Editor (TinyMCE)
- - LIVE Editor (Click to Edit Mode)
- Styling Content
- Images / Backgrounds
- Banners and Sliders
- Uploading content
- Design Templates
- フォーム
- More Q & A
- Menus
- Mobile Styling and Optimisation
Advanced Page Types
電子商取引
- Shopping Basics
- Product Pricing, Currencies
- Category Management
- 製品
- Product Options
- Layout and Formatting
- 支払いオプション
- Freight - Couriers
- Processing Orders
- Orders / Invoices
- Advanced Ecommerce
- Plugins
- 卸売
- Bookings Management System
- Stock & Quantities
- Vouchers, Discounts, Loyalty Points
- Selling Photos / Prints
- Shopping Cart Add-on Page types
- Advanced APIs / Add ons
- 販売時点管理(POS)
- レポート
Email & Membership
- Member Management
- Members Pages / Template Customisations
- From Addresses and Reply To Email Notifications
- Global Enquiry form options
- Standard Field Names
- Webmail
- Bulk Email
- CRM Features
- Email Campaigns
- Forums & Blogs
- Pop3/Imap Email Services
- Scams and Hoaxes
- Lead Magnets / Growing Your Customer Database
Promoting your site
Advanced
- Power User Options
- Form Spam Filtering
- Wordpress
- PHP Setup
- [TAGS]
- FONTS - Embedding Web Fonts
- jQuery snippets
- FONTS - Uploading local font files
- Search External Links / Import external content
- HTML / CSS Snippets
- Loading additional Material Symbols styles
- FAQ Help Map
- Advanced Template Customisation, CSS, etc
- Languages and Translations
- Importing Content from Another Platform
