Shortcodes in Email Customizer

One of the main features of Email Customizer is that it enables the editing of the text in the WooCommerce transaction. In the text you will also want dynamic data unique to the current order e.g Order, Customer Firstname, Customer Lastname, etc. We do this using the built in WordPress shortcodes - ours look like this e.g. [ec_order] [ec_firstname] [ec_lastname]

 

How to use our shortcodes:

Below you'll find a list of all our shortcodes, but first let us explain the general characteristics of our shortcodes before explaining each one individually. Like all WordPress shortcodes, ours accept specific args that control how they are displayed when they render in the emails. The two main args are show & hide. Both are, similarly, a comma separated list of elements that will display when rendering the respective shortcode. for example the Order shortcode [ec_order] defaults to showing all of the following #, number, date, link, container (all shortcodes show the container <div> by default so that you can target it and style it using CSS).

You can then customize the shortcode by using the show arg to show only the # and the Order Number like this [ec_order show="#,number"] which will display like this "#3456".
Alternatively you can use the hide arg like this [ec_order hide="container,#"] to display all the order info except the container and the #.

 

Our Shortcodes:

 

[ec_order]

This shortcode displays the main information about the order: Order Number, Date, etc (also explained in the intro above)
e.g #1431 (September 20, 2016)

args:
show - (optional) Comma separated list of the elements to show (default: number, #, date, link, container)
options:
number - the order number e.g. 1431
• # - should the order number be preceded by the '#' symbol
• date - the date portion of the order display e.g. ()
• link - should the order text have a link to the order <a href="...">...</a>. This will link to the My Account if it's a custmer email, or to the Order Edit page if it's an admin email.
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_order">...</span>
hide - (optional) same options as show

example:
[ec_order]
[ec_order show="#,number"]
[ec_order show="#, number, date, link, container"]
[ec_order hide="container"]

 

[ec_firstname]

The customers firstname.

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_firstname">...</span>
hide - (optional) same options as show

example:
[ec_firstname]

 

[ec_lastname]

The customers lastname.

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_lastname">...</span>
hide - (optional) same options as show

example:
[ec_lastname]

 

[ec_email]

The customers email address.

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_email">...</span>
hide - (optional) same options as show

example:
[ec_email]

 

[ec_pay_link]

If an order is awaiting payment (there is still money that needs to be paid) then the customer will need to visit the pay-for-order page. This shortcode outputs a link to that page, with the words 'Pay now' (or your translated language).

args:
show - (optional) Comma separated list of the elements to show (default: container)
text - (optional) customize the default text that outputs with this shortcode (default: Pay now)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_pay_link">...</span>
hide - (optional) same options as show

example:
[ec_pay_link]

 

[ec_customer_note]

This shortcode can only be used with the 'Customer Note' email that gets sent when an shop admin uses the 'Add note' feature on the Order Edit page and he chooses 'Note to customer'. As the email is sent then the Note will be inserted into the email, on the fly.
It's worth noting that this is not the Delivery Note that the customer can optionally fill in with their order delivery address e.g. "The blue house at the end of the street". If this is what you're looking for then please [ec_delivery_note] next.

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_customer_note">...</span>
hide - (optional) same options as show

example:
[ec_customer_note]

 

[ec_delivery_note] New

This is the Delivery Note that the customer can optionally fill in with their order delivery address e.g. "The blue house at the end of the street".

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_delivery_note">...</span>
hide - (optional) same options as show

example:
[ec_delivery_note]

 

[ec_user_login]

The customers Username. This shortcode is for use in the New Account email that's sent to the new customer if/when he signs up to your store.

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_user_login">...</span>
hide - (optional) same options as show

example:
[ec_user_login]

 

[ec_account_link]

A link to the customers My Account page.

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_account_link">...</span>
hide - (optional) same options as show

example:
[ec_account_link]

 

[ec_user_password]

This shortcode can only be used in the New Account email. It will output a new password for the customer if he/she requests it.

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_user_password">...</span>
hide - (optional) same options as show

example:
[ec_user_password]

 

[ec_reset_password_link]

This shortcode can only be used in the Reset Password email. It will output the words "Click here to reset your password" (or your translated language) that will link to the password-reset page for that customer.

args:
show - (optional) Comma separated list of the elements to show (default: container)
text - (optional) customize the default text that outputs with this shortcode (default: Click here to reset your password)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_reset_password_link">...</span>
hide - (optional) same options as show

example:
[ec_reset_password_link]

 

[ec_login_link]

This is for use with the New Account email. The customer will most likely not be logged-in so they will see the login screen where they can login with their username & password.

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_login_link">...</span>
hide - (optional) same options as show

example:
[ec_login_link]

 

[ec_site_name]

This will render the name of your WooCommerce store e.g. Superstore

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_site_name">...</span>
hide - (optional) same options as show

example:
[ec_site_name]

 

[ec_site_link]

Just like the [ec_site_name] shortcode above, but this one will adds a link back to your WooCommerce store e.g. Superstore

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_site_link">...</span>
hide - (optional) same options as show

example:
[ec_site_link]

 

[ec_billing_method]

Show the billing method that was chosen for the related order.

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_billing_method">...</span>
hide - (optional) same options as show

example:
[ec_billing_method]

 

[ec_shipping_method]

Show the shipping method that was chosen for the related order.

args:
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_shipping_method">...</span>
hide - (optional) same options as show

example:
[ec_shipping_method]

 

[ec_custom_field] or [ec_get_post_meta] New

The custom field shortcode allows you to output any custom field to your emails by specifying the 'key' of any custom field stored with the order. For example you can output the Company Name like this [ec_custom_field key="_billing_company"].

Note that when the custom fields are saved to the Order by WooCommerce they usually have a preceeding "_" underscore (which intentionally hides them on the order-edit page in wp-admin). To help you you find the key names for all the Orders' hidden custom fields you can use this helpful plugin Show Hidden Post Meta.

args:
key - the key of the custom field you'd like to output to your email.
id - (optional) the id of the order, or post, that you'd like to get the custom field from. If empty we'll use the current order (if this is an order email).
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_custom_field ec_get_post_meta">...</span>
hide - (optional) same options as show

example:
[ec_custom_field key="_billing_company"]
[ec_custom_field key="_billing_company" id="4556"]

 

[ec_get_option] New

This shortcode allows you to output any saved option to your emails by specifying the 'key' of the option. For example you can output your blogname like this [ec_get_option key="blogname"].

args:
key - the key of the option you'd like to output to your email.
show - (optional) Comma separated list of the elements to show (default: container)
options:
• container - a span for you to target via your css looks like <span class="ec_shortcode ec_get_option">...</span>
hide - (optional) same options as show

example:
[ec_get_option key="blogname"]

 

 

[the end]

 

Be the first to post a comment.

Add a comment