Shortcodes

Shortcode is a coded representation of some variable, such as customer name or order ID. When you create a template, you cannot know beforehand the name of the customer to whom an email will be sent. So you just print {full_name} in a place where customer name should be, and shortcode will be replaced with an actual name of a customer to whom the email is sent.
There are dozens of supported shortcodes. The full list can be found at ‘Shortcodes list’ tab (figure 1)

Email Manager. Shortcodes list tab
Figure 1. Shortcodes list tab

Each shortcode has content only at specific context. For example {order_id} can be evaluated only for emails related to order (order creation, order status change). Shortcode {full_name} can be evaluated for order-related emails, account creation email, transaction email and the like. You can see shortcode context at ‘Shortcodes list’ tab (figure 1). It can be some specific context such as ‘Customer – New’ (email sent to a customer on account creation) or some general context such as ‘Customer’ (all the emails sent to a customer). Using ‘Context filter’ control from ‘Shortcodes list’ tab you can filter shortcodes by context.

Some shortcodes can accept arguments. For example, {account_login_url(Text)} – returns a link to account login page (for a customer or an affiliate) – where ‘Text’ is a text of a link (you need to specify your own text, e.g ‘Log in’ or the like). As an argument a shortcode can accept another shortcode: {account_login_url(Login to {store_name} )} – will be replaced by a link with text ‘Login to My Store’ (where ‘My Store’ will be the name of your store of course)

There is another type of shortcodes – conditional. These shortcodes consist of two parts: the opening and the closing. Opening part starts with ‘{if_’ and closing starts with ‘{/if_’. For example {if_order_download}Conditional text{/if_order_download} – checks if an order contains downloadable product. If shortcode evaluates to a true value then text between the opening and the closing parts will be displayed (in this example ‘Conditional text’), if shortcode evaluates to a false value – conditional text will be discarded. Conditional text can contain other shortcodes. For example, you can check if an order status belongs to completed statuses and show one message to a customer if it doesn’t – another message: {if_no_order_approve}Follow {download_url( this link )}
to download the product{/if_no_order_approve} {if_order_approve}You will be able to download the product after we approve the purchase{/if_order_approve}

Another one type of shortcodes – complex:

  • Vitrine – set of products to be promoted
  • Social – set of social icons
  • Button – Call To Action Button >QR Code

  • Invoice – customizable substitution for OpenCart standard invoice

These shortcodes need to be created before you can use them. You can create as many complex shortcodes of each type as you need. For example, you can create several Call To Action Buttons: login into an account, view an order, download product and the like

To make it easier to print shortcodes and avoid errors the list of available shortcodes appears when you start typing shortcode name in shortcode-able input field (figure 2)

Email Manager. Shortcoddable input field
Figure 2. Shortcodable input field

Also, there are combos with list of ‘Vitrine’ and ‘Call to action button’ shortcodes so that you can insert these shortcodes in one click (figure 2)