Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Content Wrapper template file

Content Wrapper template file

The CWT file is a template. It determines how the Dynamic Content is rendered. It can include references to parameters defined in the Content Wrapper XML file (both the user-input-settings and the template-parameters. To refer to a parameter, specify the name preceded by the dollar sign ($) character.

Like the Content Wrapper XML files, CWT files are stored in the <assets>/content-wrappers directory and are reloaded periodically and the Content Wrappers (XML files and CWT files) are reloaded (by default, every 600 seconds). You can configure the reload interval by editing the COMMERCE/SYSTEM/CONTENTWRAPPERS/reloadInterval setting. If you are testing changes to Content Wrappers and want to see your changes reflected more quickly, decrease the reload interval.


CWT files are rendered using the Velocity engine, but it is not the same instance used to render storefront templates and it does not have any of the storefront context. It may only reference objects passed to it via the parameters defined in the Content Wrapper XML file.

The following is a sample Content Wrapper template:

<!-- Simple image with alt text and on click action -->
<a href="$onClick"><img alt="$altText" border="0" src="$baseDcAssetUrl/$imagePath"/commerce-legacy/></a>
<!-- /Simple image with alt text and on click action -->
Note: Design Tip

Try to avoid including a lot of formatting information in the Content Wrapper template. It can interfere with styles and page layout around the Content Wrapper. Likewise, the styles in the containing page may cause the Content Wrapper to not appear as intended. To reduce the need for web developer customization, it is best to make the Content Wrapper template as generic as possible.

Special variables

In addition to the parameters passed from the Content Wrapper XML file, there are two other variables that can be used in Content Wrapper templates:

  • $baseUrl, which contains the web application context (by default, /storefront).
  • $baseDcAssetUrl, which contains the web path that resolves to the dynamiccontent asset directory.

    When referring to an asset in a subdirectory of dynamiccontent (for example, images or flash), do not include the subdirectory name.