Skip to main content

getTemplateByType

Getting all template objects, grouped by types

Templates.getTemplateByType(type, langCode)

const value = await Templates.getTemplateByType('forCatalogProducts')
Schema

type:* Types
Product marker
example: forCatalogProducts

langCode: string
Optional parameter language code
example: en_US

This method retrieves a single template object based on its identifier (id) from the API. It returns a Promise that resolves to a template object.

Example return:

[
{
"id": 1764,
"generalTypeId": 4,
"generalTypeName": "forCatalogProducts",
"title": "Page template",
"identifier": "marker",
"position": 1,
"version": 10,
"attributeValues": {
"marker": {
"value": "",
"type": "string",
"position": 1,
"isProductPreview": false,
"isIcon": false,
"attributeFields": {
"marker": {
"type": "string",
"value": "test"
}
}
}
},
"attributeSetIdentifier": "my-set"
}
]
Schema

id: number
object identifier
example: 1764

version number
object's version number of modification
example: 10

identifier: string
textual identifier for a field in the record
example: catalog

generalTypeId: number
type identifier
example: 4

title: string
template name
example: page template

position object
position number
example: 0

generalTypeName string
example: forProductPreview
general type name