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:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?