SuiteCommerce Development Best Practices

Avoid involving core modules.Do not use Backbone modules.

  1. Avoid involving core modules.
  2. Do not use Backbone modules.
  3. Do not use JavaScript in Templates.
  4. Do not extend Extensions.
  5. Use Extensibility API 2
  6. Use SC Basic modules
  7. Use Configuration and SMT
  8. Evaluate SCA target version carefully

Avoid involving core modules

  • include a core module in a require() or define() statement.
  • extend (extend()) a core module to add or overwrite a method or property.
  • wrap (_.wrap()) a core module’s method to change its output.
  • modify a core module or object’s prototype.
  • access the SC global variable.
  • edit core modules directly in SCA, use overrides instead.

Do not use Backbone modules

Not use Backbone modules
• Backbone.Model
• Backbone.Collection
• Backbone.View
• Backbone.FormView
• Backbone.CollectionView

Use SC Basic modules
• SCModel
• SCCollection
• SCView
• SCFormView
• SCCollectionView

Do not extend Extensions

Use Configuration and SMT

Configure SC/A through:
• SuiteCommerce Configuration
• Site Management Tools (SMT)
Use the Environment component to get configuration values of the website instead of
the SC.Configuration module or the SC global variable.

var env = container.getComponent('Environment');
var addToCartBehavior = env.getConfig('addToCartBehavior');

Evaluate Extension Target Version

When you run the theme or extension developer tools, you have to specify the Commerce product for which your
theme or extension applies and which releases of those products are compatible with your theme or extension.

"target_version": {
"SCA": ">=21.2.0"
,
"SCS": ">=21.2.0"
}

Make your extension compatible with old SCA versions

var userProfile = container.getComponent('UserProfile');
if(userProfile) {
// Component is available
}

What can be included in an extension?
Extensions support several kind of resources:
• JavaScript
• Templates
• Sass
• Configuration
• Services (SS1 & SS2)

And generally include account objects such as:
• Custom Records
• Custom Roles
• Custom Scripts
• SuiteLet
• RestLet
• Map/Reduce

Leave a comment

Your email address will not be published. Required fields are marked *