Override a Template File
Documentation article about Override a Template File
Important:
Making changes to core JavaScript source files or changing vital functionality of the application can make migrating to future releases difficult. Before making changes to SuiteCommerce Advanced (SCA), see Best Practices for Customizing SCA.
This example describes how to override a template file if you are on the Kilimanjaro release of SCA or earlier. If implementing the Aconcagua release of SCA or later, the best practice is to use themes and extensions to customize your website. See Develop Themes and Develop Extensions for more information.
When customizing SCA, you may need to change the HTML code of the application. To add, remove, or change the HTML, you must customize the template file for the module that corresponds to the feature you want to change. To customize a template, you must use the override method provided by the SCA developer tools. Because there is no mechanism for overriding or extending a specific part of a template, you must override the entire file.
This example describes how to override a template file to add additional text to the product description page. You can use this example as a guide when customizing your own templates.
To override a template:
-
Create a directory to store your template. Where you place this directory depends on your implementation.
-
If implementing 2019.2 and later, create this directory within the SCA source code root directory. Examples:
SC_20.1/extensions,SC_19.2_Live/extensions. -
If implementing 2019.1 and earlier, create this directory within the Modules directory. For example:
Modules/extensions.
-
In the
extensionsdirectory, create a subdirectory calledItemDetailsExtension@1.0.0.When creating a new custom module, the module name must be unique. You must not have duplicate module names, even if those modules reside in different folders.
-
In the
ItemDetailsExtension@1.0.0directory, create a subdirectory calledTemplates. -
If required, create another subdirectory called
Sass.
You should create a directory structure similar to that described in Organize Source Code for Custom Modules.
-
-
Copy the original template file to your custom directory. The string
x.y.zcorresponds to the version of the ItemDetails module in your version of SCA.-
If implementing 2019.2 and later, copy the
item_detail.tplfile from/ItemDetails@x.y.z/Templatesto theTemplatesdirectory of your custom application module. -
If implementing 2019.1 and earlier, copy the
item_detail.tplfile fromModules/suite_commerce/ItemDetails@x.y.z/Templatesto theTemplatesdirectory of your custom application module.
-
-
Create the
ns.package.jsonfile.You must create this file in the
ItemDetailsExtension@1.0.0directory. -
Add the required code to the
ns.package.jsonfile.-
If implementing 2019.2 and later, the contents of your
ns.package.jsonfile should be similar to:json1{2 "gulp": {3 "templates": [4 "Templates/*"5 ]6 , "sass": [7 "Sass/**/*.scss"8 ]9 },10 "overrides": {11 "Advanced/ItemDetails@x.y.z/Templates/item_details.tpl": "Templates/item_details.tpl"12 }13} -
If implementing 2019.1 and earlier, the contents of your
ns.package.jsonfile should be similar to:json1{2 "gulp": {3 "templates": [4 "Templates/*"5 ]6 , "sass": [7 "Sass/**/*.scss"8 ]9 },10 "overrides": {11 "suitecommerce/ItemDetails@x.y.z/Templates/item_details.tpl": "Templates/item_details.tpl"12 }13}
Note:
You must replace the string
x.y.zin the preceding code samples with the version of the ItemDetails module in your version of SCA. SutieCommerce 2019.2 and later do not include the @x.y.z directory name suffix.The first section of the preceding code samples defines the required objects used by gulp to include your customized template and Sass files when combining the application.
The second section contains the override directive, which maps the original file in the SCA source distribution directory to your custom template file. This mapping tells the gulp.js combiner to override a specific file.
-
-
Edit your custom template.
This procedure shows the basic steps required to modify a template. However, you can fully customize your templates as requir
Frequently Asked Questions (4)
What are the prerequisites for overriding a template file in SuiteCommerce Advanced?
How do I set up the directory structure for overriding a template in SCA 2019.2 and later?
How do I ensure my custom module name is unique when overriding a template file?
How is the `ns.package.json` file configured differently for SCA 2019.2 and later versus earlier versions?
Was this article helpful?
More in General
- Field Service Management Enhancements and Bug Fixes for 2026
Overview of the 2026 Field Service Management SuiteApp updates showcasing enhancements and bug fixes.
- Example
Documentation article about Example
- Pass String Literals
Documentation article about Pass String Literals
- Manual Edits
Documentation article about Manual Edits
Advertising
Reach General Professionals
Put your product in front of NetSuite experts who work with General every day.
Sponsor This Category