Documentation

How to use placeholders supporting template views

How to use placeholders supporting template views#

Most placeholders rely on showing just text content, which you can compose into a message, but there are a few special placeholders that can output more structured content with pictures to the email message. In such case it would be good to be able to decide, what kind of output you would like to show your customers - should it be just a plain list of ordered products of the grid with images of upselling recommendations.

Placeholders with template argument#

Those placeholders accept a template argument to specify how would you like to show the items in your message.

  • {{ order.products_ordered }}
  • {{ order.related_products }}
  • {{ order.cross_sells }}
  • {{ order.products_ordered_review_links }}
  • {{ order.products_ordered_links }}
  • {{ subscription.items }}

All placeholders listed above mutually have templates for the comma separated list and bullet list. Additionally, some placeholders can also show items in a grid with a template in 2 or 3 columns. Placeholders that support this type of view are {{ order.products_ordered }} , {{ order.related_product }} , {{ order.cross_sells }} .

Generally, the list of available templates for placeholder is:

  • Comma separated list
  • Bullet list
  • Grid - 2 columns
  • Grid - 3 columns

Constraints#

Using the grid template is restricted only to Send Mail action in HTML version with WooCommerce template for email. Send Mail (Plain) or custom email template action doesn't include any stylesheet needed to properly set your items in a grid. If you'd like to use a grid template in your custom email template, you need to provide your own stylesheet definition. You can find required CSS classes in files inside shopmagic-for-woocommerce/templates/placeholder/products_ordered folder.

Extending templates#

With a bit of coding, you can extend or override placeholder templates.

In your theme add the folder shopmagic/placeholder/products_ordered and put there any template you would like to add or override.

If you are overriding our templates, the name of the file must match the template name, i.e. for a Comma separated list, create file comma_separated_list.php .

If you wish to add some templates to placeholders, besides adding a template file in folder, you need to register it to use, by hooking a filter shopmagic/core/placeholder/products_ordered/templates . In the filter, you need to register the file name and the label for display in an associative array, as in the example below.

You can add this snippet to your functions.php in theme.

add_filter('shopmagic/core/placeholder/products_ordered/templates', static function (array $templates): array {
  $templates['my_placeholder_template'] = esc_html__('My placeholder template');
  return $templates;
});
Not the solution you are looking for?

Please check other articles or open a support ticket.

Cookies preferences

Others

Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.

Necessary

Necessary
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.

Advertisement

Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.

Analytics

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.

Functional

Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.

Performance

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.