Umbraco Commerce
CMSCloudHeartcoreDXP
13.latest (LTS)
13.latest (LTS)
  • Umbraco Commerce Documentation
  • Release Notes
    • v13.1.0-RC
  • Commerce Products
    • Commerce Packages
    • Commerce Payment Providers
    • Commerce Shipping Providers
  • Installation
    • Installing Umbraco Commerce
    • Licensing
  • Upgrading
    • Upgrading Umbraco Commerce
    • Version Specific Upgrade Notes
    • Migrate from Vendr to Umbraco Commerce
      • Migrate Umbraco Commerce Checkout
      • Migrate custom Payment Providers
  • Getting Started
    • Introduction
    • Umbraco Configuration
    • User Interface
  • How-To Guides
    • Overview
    • Configure SQLite support
    • Limit Order Line Quantity
    • Use an Alternative Database for Umbraco Commerce Tables
    • Add item to Cart
    • Update Cart
    • Delete item in Cart
    • Customizing Templates
  • Key Concepts
    • Get to know the main features
    • Base Currency
    • Bulk Actions
    • Calculators
    • Dependency Injection
    • Discount Rules / Rewards
    • Events
      • List of validation events
      • List of notification events
    • Fluent API
    • Order Calculation State
    • Payment Forms
    • Payment Providers
    • Pipelines
    • Price/Amount Adjustments
    • Price Freezing
    • Product Adapters
    • Product Bundles
    • Product Variants
      • Complex Variants
    • Properties
    • ReadOnly and Writable Entities
    • Search Specifications
    • Settings Objects
    • Shipping Package Factories
    • Shipping Providers
    • Shipping Range/Rate Providers
    • Tax Sources
    • UI Config Files
    • Umbraco Properties
    • Unit of Work
    • Umbraco Commerce Builder
    • Webhooks
  • Tutorials
    • Overview
  • Reference
    • Stores
    • Shipping
      • Fixed Rate Shipping
      • Dynamic Rate Shipping
      • Realtime Rate Shipping
    • Storefront API
      • Endpoints
        • Order
        • Checkout
        • Product
        • Customer
        • Store
        • Currency
        • Country
        • Payment method
        • Shipping method
        • Content
    • Go behind the scenes
Powered by GitBook
On this page
  • Accessing the Default Built-in Templates
  • Creating Custom Templates
  • Email Templates
  • Print and Export Templates
  • Shipping Custom Templates in a Razor Class Library

Was this helpful?

Edit on GitHub
Export as PDF
  1. How-To Guides

Customizing Templates

Learn how to create custom templates for emails, prints, and exports.

PreviousDelete item in CartNextGet to know the main features

Last updated 5 months ago

Was this helpful?

Umbraco Commerce provides support for customizing templates for emails, prints, and exports. This allows you to tailor the outputs of your e-commerce solution to meet specific branding or functional requirements.

Accessing the Default Built-in Templates

The default templates for email, print, and export are embedded in Razor Class Libraries (RCLs) in Umbraco Commerce. To customize these templates, you can extract them and use them as a starting point.

Download the custom templates and place them in /Views/Partials/Commerce/Email/.

Creating Custom Templates

Email Templates

To Create a Custom Email Template:

  1. Create a Razor view file (.cshtml) in /Views/Partials/Commerce/Email/.

  2. Implement the IEmailTemplate interface to make the template available in Umbraco Commerce:

using Umbraco.Commerce.Core.Interfaces;  

public class CustomOrderEmailTemplate : IEmailTemplate  
{  
    public virtual string FileName => "CustomOrderEmail.cshtml";  
}  
  1. Register the Template in a Composer:

using Umbraco.Cms.Core.Composing;  
using Umbraco.Cms.Core.DependencyInjection;  

public class CustomTemplateComposer : IComposer  
{  
    public void Compose(IUmbracoBuilder builder)  
    {  
        builder.EmailTemplates().Add<CustomOrderEmailTemplate>();  
    }  
}  

Print and Export Templates

To create Print/Export Templates:

  1. Create a Razor view file (.cshtml) under the relevant paths:

/Views/Partials/Commerce/Prints/  
/Views/Partials/Commerce/Exports/  
  1. Implement the IPrintTemplate or IExportTemplate interface to make the template available in Umbraco Commerce.

  2. Register the template in a Composer similar to the email template process.

Shipping Custom Templates in a Razor Class Library

To distribute custom templates as part of a Razor Class Library (RCL):

  1. Create a new Razor Class Library project.

  2. Add the template files under appropriate paths, for example, Views/Partials/Commerce/Emails/.

  3. Implement interfaces like IEmailTemplate, IPrintTemplate,or IExportTemplate .

  4. Use a composer to register your custom templates.

15KB
Umbraco.Commerce.Templates.v13.zip
archive
Umbraco Commerce Custom Templates