How to use placeholders with template views#
Some ShopMagic placeholders can display structured content, such as product lists or grids with images. Use the template parameter to choose how this content appears in your message.
Placeholders that support templates#
| Placeholder | Content | Available templates |
|---|---|---|
{{ order.products_ordered }} |
Products from the current order | Comma-separated list, bullet list, two-column grid, three-column grid |
{{ order.quantity_products }} |
Ordered products with their quantities | Comma-separated list, bullet list, two-column grid, three-column grid |
{{ order.related_products }} |
Related products based on the products in the order | Comma-separated list, bullet list, two-column grid, three-column grid |
{{ order.cross_sells }} |
Cross-sell products configured for products in the order | Comma-separated list, bullet list, two-column grid, three-column grid |
{{ order.products_ordered_links }} |
Ordered products with links to their product pages; requires ShopMagic Review Requests | Comma-separated list, bullet list, two-column grid, three-column grid |
{{ order.products_ordered_review_links }} |
Ordered products with links to their review sections; requires ShopMagic Review Requests | Comma-separated list, bullet list, two-column grid, three-column grid |
{{ cart.items }} |
Cart products; requires ShopMagic Abandoned Carts | Comma-separated list, bullet list, two-column grid, three-column grid; also supports JSON output |
{{ subscription.items }} |
Products from the current subscription; requires ShopMagic for WooCommerce Subscriptions | Comma-separated list and bullet list |
The automation’s event must provide the relevant order, cart, or subscription data. Recommendation placeholders also need matching products to display.
Choosing a template#
- Click a supported placeholder in the automation editor.
- Select a layout in the Template field.
- Copy the generated placeholder into your message.
- Send a test email to check the result.
The standard template names and parameter values are:
- Comma separated list —
comma_separated_list - Bullet list —
unordered_list - Grid - 2 columns —
grid_2_col - Grid - 3 columns —
grid_3_col
For example, display ordered products as a bullet list:
{{ order.products_ordered | template: 'unordered_list' }}
Display product images and names in a two-column grid:
{{ order.products_ordered | template: 'grid_2_col' }}
Or use a three-column grid:
{{ order.products_ordered | template: 'grid_3_col' }}
Email formatting and limitations#
Use grid templates in the message body of an HTML email. With the Send Email action, select the WooCommerce email template to include ShopMagic’s grid styling.
If you select None or use a custom HTML email template, provide the necessary styling yourself. The grid markup is defined in:
shopmagic-for-woocommerce/templates/placeholder/products_ordered/
The shared layout styles are defined in:
shopmagic-for-woocommerce/templates/emails/email-styles.php
Plain-text emails do not support HTML grids or images. Use a comma-separated list for plain-text messages. Keep HTML lists and grids out of email subject fields.
Email clients may display layouts differently or block remote images. Check a received test email before publishing your automation.
Overriding an existing template#
You can customise a placeholder’s output by placing a replacement PHP template in your active theme, preferably a child theme.
For example, to override the comma-separated product list, copy:
shopmagic-for-woocommerce/templates/placeholder/products_ordered/comma_separated_list.php
To:
wp-content/themes/your-child-theme/shopmagic/placeholder/products_ordered/comma_separated_list.php
Keep the original filename. You do not need to register an existing template again.
Use the appropriate relative directory for each placeholder:
placeholder/products_ordered/— Ordered products, related products, cross-sells, and cart product views.placeholder/quantity_products/— Ordered products with quantities.placeholder/products-ordered-links/— Product links from Review Requests.placeholder/products-ordered-review-links/— Review links from Review Requests.
Overrides in the shared products_ordered directory can affect several placeholders. The subscription.items placeholder builds its lists directly and does not use these PHP template files.
Adding a custom template#
First, copy an existing template into the appropriate theme directory and give it a new filename. For example:
wp-content/themes/your-child-theme/shopmagic/placeholder/products_ordered/my_placeholder_template.php
Modify the copied template, then register its name using the following filter in your child theme’s functions.php or a custom plugin:
add_filter(
'shopmagic/core/placeholder/products_ordered/templates',
static function ( array $templates ): array {
$templates['my_placeholder_template'] = 'My placeholder template';
return $templates;
}
);
The array key must match the filename without the .php extension. You can then use:
{{ order.products_ordered | template: 'my_placeholder_template' }}
Note: This filter changes the shared template selector used by several placeholders. Registering a name does not create a template file. If you select the custom template for a placeholder using a different directory, provide a matching file in that directory too.

