Create email template formatter for a custom order confirmation

The IOrderConfirmationEmailTemplateFormatter interface allows you to modify the template of the order confirmation email, and add, remove or replace whatever you need. To do this, you must perform the following:

  1. Create a class for your custom formatter.
    Create a class that will represent the formatter for the confirmation e-mail. In this example the name CreateEmailTemplateForCustomerOrder is used.
  2. Inherit the OrderConfirmationEmailTemplateFormatterBase class.
    Your custom formatter class must inherit the OrderConfirmationEmailTemplateFormatterBase class.
  3. Implement the IOrderConfirmationEmailTemplateFormatter interface, by implementing method ReplaceValuesInTemplate.
  4. Implement the ReplaceValuesInTemplate method.
    In this method you can get the formatted template and do any additional modifications you want. To do this, call the ReplaceValuesInTemplateBase method of the base class. It returns the already formatted template as a string. Modify the string by adding, replacing or removing the elements you want. Finally return the modified template.
  5. Register the custom formatter.
    In the Global.asax file, register the custom formatter in the following way:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?