Customizing templates
NewStore uses customizable document templates to generate digital or print communication for the customer during order placement, checkout, shipping, and processing.
Templates are rendered to two types of documents: HTML and text. Some of these documents are converted into PDF for printing. Financial and fulfillment documents are converted to PDF when a printout is requested.
A template is made of the following 3 main parts that you can customize:
- A Jinja2 template, which can include other templates
- Visual styling as CSS
- Data as JSON
Template types
Several templates are available, to display them, use the list templates method.
Depending on the document type to generate from a template, you might work with one or more templates. For example, email templates are divided into a subject template and an email body template. Push notification templates are typically in JSON format and SMS templates are typically a string.
Template properties
Each template offers pre-defined properties. The properties depend on the template type. For example, some templates do not allow you to display the payment method used for an order.
To display the available properties in a given template type, use the Get sample data method. This method returns the mock data that contains an example of each template property.
Customizing a template
Once you know your template identifier and its properties, you can start customizing it. To update a template:
- Retrieve the default template using the get template method. The response payload is a jinja2 template.
- Modify the template as needed.
- Update the default template with your changes using the update template method.
- Preview it using the preview document method.
For more information, see Tutorial: Creating templates .
Related links