{"id":426081,"date":"2024-03-05T13:42:10","date_gmt":"2024-03-05T13:42:10","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=426081"},"modified":"2024-04-05T07:17:41","modified_gmt":"2024-04-05T07:17:41","slug":"how-to-apply-a-transformation-to-an-email-template-from-an-external-module","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/","title":{"rendered":"How to apply a transformation to an email template from an external module"},"content":{"rendered":"\n<p>In this blog, we are going to learn, How to apply a transformation to an email template from an external module. We can apply our own transformation to the content from our module.<\/p>\n\n\n\n<p>We can add multiple content transformation. To implement this feature we require you to know\u00a0<a href=\"https:\/\/webkul.com\/blog\/how-to-add-email-layouts-in-a-theme-from-an-external-module\/\">How to add email layouts in a theme<\/a>. After adding a customized layout to a theme. Here is an example of an email layout using the TransformationInterface.<\/p>\n\n\n\n<p>The\u00a0<code>Transformation Interface<\/code>\u00a0is a powerful and handy way to modify our email template\u2019s design easily. Let us check out the interface details:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace PrestaShop\\PrestaShop\\Core\\MailTemplate\\Transformation;\n\ninterface TransformationInterface\n{\n    \/**\n     * @param string $templateContent\n     * @param array $templateVariables\n     *\n     * @return string\n     *\/\n    public function apply($templateContent, array $templateVariables);\n\n    \/**\n     * Returns the type of templates this transformation is associated with,\n     * either html or txt, so that the renderer knows if it has to be applied\n     * or not\n     *\n     * @return string\n     *\/\n    public function getType();\n\n    \/**\n     * @param LanguageInterface $language\n     *\n     * @return $this\n     *\/\n    public function setLanguage(LanguageInterface $language);\n}<\/pre>\n\n\n\n<p>The&nbsp;<code>apply<\/code>&nbsp;method is the most important, it receives the rendered layout content as a string, then we can perform the string replacement or even DOM (Document Object Model) manipulation as long as we return the&nbsp;<strong>whole<\/strong>&nbsp;template as a string (if we do not want modify it, we can simply return the string un modified).<\/p>\n\n\n\n<p>The&nbsp;<code>getType<\/code>&nbsp;method is used to filter transformations (a transformation is only applicable) to&nbsp;<strong>one<\/strong>&nbsp;type, as for the&nbsp;<code>setLanguage<\/code>&nbsp;method it will allow you to know the language used in this generation which is handy if you need to add localized texts or images.<\/p>\n\n\n\n<p>Let&#8217;s start,<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Layout<\/strong><\/h2>\n\n\n\n<p>For this example, we will use the same layout we use in <a href=\"https:\/\/webkul.com\/blog\/how-to-add-email-layouts-in-a-theme-from-an-external-module\/\">How to add email layouts in a theme<\/a>. <\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">{# modules\/WkTestModule\/mails\/layout\/custom_classic_webkul_layout.html.twig #}\n\n{# You can use the theme layout (if present) to extend it easily #}\n{% extends &#039;@MailThemes\/classic\/components\/layout.html.twig&#039; %}\n\n{% block content %}\n&lt;tr&gt;\n  &lt;td class=&quot;space_footer&quot;&gt;&amp;nbsp;&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n  &lt;td class=&quot;space_footer&quot;&gt;\n    &lt;table width=&quot;100%&quot;&gt;\n      &lt;tr&gt;\n        &lt;td align=&quot;center&quot; class=&quot;titleblock&quot;&gt;\n          &lt;font size=&quot;2&quot; face=&quot;{{ languageDefaultFont }}Open-sans, sans-serif&quot; color=&quot;#555454&quot;&gt;\n            &lt;strong class=&quot;title&quot;&gt;{{ &#039;This is an example mail template from my test module for classic theme&#039;|trans({}, &#039;EmailsBody&#039;, locale)|raw }}&lt;\/strong&gt;\n          &lt;\/font&gt;\n        &lt;\/td&gt;\n      &lt;\/tr&gt;\n      &lt;tr&gt;\n        &lt;td align=&quot;center&quot; class=&quot;titleblock&quot;&gt;\n          &lt;font size=&quot;2&quot; face=&quot;{{ languageDefaultFont }}Open-sans, sans-serif&quot; color=&quot;#555454&quot;&gt;\n            &lt;span class=&quot;wk_subtitle&quot;&gt;{{ customizedMessage }}&lt;\/span&gt;\n          &lt;\/font&gt;\n        &lt;\/td&gt;\n      &lt;\/tr&gt;\n      &lt;tr&gt;\n        &lt;td class=&quot;space_footer&quot;&gt;&amp;nbsp;&lt;\/td&gt;\n      &lt;\/tr&gt;\n    &lt;\/table&gt;\n  &lt;\/td&gt;\n&lt;\/tr&gt;\n{% endblock %}\n{% block footer %}\n&lt;tr&gt;\n  &lt;td class=&quot;space_footer&quot;&gt;&amp;nbsp;&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n  &lt;td class=&quot;footer&quot; style=&quot;border-top: 4px solid #333333&quot;&gt;\n    &lt;span&gt;{{ &#039;&lt;a href=&quot;{shop_url}&quot;&gt;{shop_name}&lt;\/a&gt; created by &lt;a\n        href=&quot;https:\/\/webkul.com\/&quot;&gt;Webkul&lt;\/a&gt;&#039;|trans({&#039;{prestashop_url}&#039;:\n      &#039;https:\/\/www.prestashop.com\/?utm_source=marchandprestashop&amp;utm_medium=e-mail&amp;utm_campaign=footer_1-7&#039;},\n      &#039;Emails.Body&#039;, locale)|raw }}&lt;\/span&gt;\n  &lt;\/td&gt;\n&lt;\/tr&gt;\n{% endblock footer %}<\/pre>\n\n\n\n<p>Note: The&nbsp;<code>&lt;span class=\"wk_subtitle\"&gt;<\/code>&nbsp;that contains the custom message, we will use a CSS selector for our content transformation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Transformation class<\/h2>\n\n\n\n<p>In this example, we are going to create a class implementing the&nbsp;<code>TransformationInterface<\/code> and define its needed methods. Its purpose is to change the color of all the&nbsp;<code>&lt;span&gt;<\/code>&nbsp;tags with the&nbsp;<code>wk_subtitle<\/code>&nbsp;class.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nnamespace PrestaShop\\Module\\WkTestModule\\MailTemplate\\Transformation;\n\nuse PrestaShop\\PrestaShop\\Core\\Exception\\InvalidArgumentException;\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\MailTemplateInterface;\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\Transformation\\AbstractTransformation;\nuse Symfony\\Component\\DomCrawler\\Crawler;\nuse DOMElement;\n\n\/**\n * Class CustomMessageColorTransformation adds the custom color to all spans\n * with class subtitle.\n *\/\nclass CustomMessageColorTransformation extends AbstractTransformation\n{\n    \/** @var string *\/\n    private $customColor;\n\n    \/**\n     * @param string $customColor\n     * @throws InvalidArgumentException\n     *\/\n    public function __construct($customColor)\n    {\n        parent::__construct(MailTemplateInterface::HTML_TYPE);\n        $this-&gt;customColor = $customColor;\n    }\n\n    \/**\n     * @inheritDoc\n     *\/\n    public function apply($templateContent, array $templateVariables)\n    {\n        $crawler = new Crawler($templateContent);\n        $customSpans = $crawler-&gt;filter(&#039;span&#091;class=&quot;wk_subtitle&quot;]&#039;);\n        \/** @var DOMElement $customSpan *\/\n        foreach ($customSpans as $customSpan) {\n            $customSpan-&gt;setAttribute(&#039;style&#039;, sprintf(&#039;color: %s;&#039;, $this-&gt;customColor));\n        }\n\n        return $crawler-&gt;html();\n    }\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Using the hook<\/h2>\n\n\n\n<p>Now we need to add our transformation for this mentioned layout, in order to do this we will use the MailTemplateRendererInterface::GET_MAIL_LAYOUT_TRANSFORMATIONS &nbsp;hook.<br>It derive the following hook name &#8220;actionGetMailLayoutTransformations&#8221;<\/p>\n\n\n\n<p>Now, we are going to define this hook in our modules main file.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\MailTemplateInterface;\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\MailTemplateRendererInterface;\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\Layout\\LayoutInterface;\nuse PrestaShop\\PrestaShop\\Core\\MailTemplate\\Transformation\\TransformationCollectionInterface;\nuse PrestaShop\\Module\\WkTestModule\\MailTemplate\\Transformation\\CustomMessageColorTransformation;\n\nclass WkTestModule extends Module \n{\n   public function install() \n   {\n        return parent::install()\n            \/\/ This class constant contains &#039;actionGetMailLayoutTransformations&#039;\n            &amp;&amp; $this-&gt;registerHook(MailTemplateRendererInterface::GET_MAIL_LAYOUT_TRANSFORMATIONS)\n        ;\n    }\n    \n    public function uninstall() \n    {\n        return parent::uninstall()\n            &amp;&amp; $this-&gt;unregisterHook(MailTemplateRendererInterface::GET_MAIL_LAYOUT_TRANSFORMATIONS)\n        ;        \n    }\n    \n    public function enable() \n    {\n        return parent::enable()\n            &amp;&amp; $this-&gt;registerHook(MailTemplateRendererInterface::GET_MAIL_LAYOUT_TRANSFORMATIONS)\n        ;\n    }\n    \n    public function disable() \n    {\n        return parent::disable()\n            &amp;&amp; $this-&gt;unregisterHook(MailTemplateRendererInterface::GET_MAIL_LAYOUT_TRANSFORMATIONS)\n        ;        \n    }\n    \n    \/**\n     * @param array $hookParams\n     *\/\n    public function hookActionGetMailLayoutTransformations(array $hookParams)\n    {\n        if (!isset($hookParams&#091;&#039;templateType&#039;]) ||\n            MailTemplateInterface::HTML_TYPE !== $hookParams&#091;&#039;templateType&#039;] ||\n            !isset($hookParams&#091;&#039;mailLayout&#039;]) ||\n            !isset($hookParams&#091;&#039;layoutTransformations&#039;])) {\n            return;\n        }\n\n        \/** @var LayoutInterface $mailLayout *\/\n        $mailLayout = $hookParams&#091;&#039;mailLayout&#039;];\n        if ($mailLayout-&gt;getModuleName() != $this-&gt;name) {\n            return;\n        }\n\n        \/** @var TransformationCollectionInterface $transformations *\/\n        $transformations = $hookParams&#091;&#039;layoutTransformations&#039;];\n        $transformations-&gt;add(new CustomMessageColorTransformation(&#039;#0000FF&#039;));\n    }\n}<\/pre>\n\n\n\n<p>We can check the result. To check the we need to go to the \u201cDesign &gt; Email Theme\u201d page and preview our layout. We will see that our message has now changed its color.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"749\" height=\"363\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png\" alt=\"Transformation\" class=\"wp-image-426085\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png 749w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11-300x145.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11-250x121.png 250w\" sizes=\"(max-width: 749px) 100vw, 749px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>That\u2019s all about this blog.<\/p>\n\n\n\n<p>If any issues or doubts in the above step, please feel free to let us know in the comment section.<\/p>\n\n\n\n<p>We would be happy to help.<\/p>\n\n\n\n<p>You can also explore our&nbsp;<a href=\"https:\/\/webkul.com\/prestashop-development\/\">PrestaShop Development Services<\/a>&nbsp;and a large range of quality&nbsp;<a href=\"https:\/\/store.webkul.com\/PrestaShop-Extensions.html\">PrestaShop Modules<\/a>.<\/p>\n\n\n\n<p>For any doubt contact us at&nbsp;<a href=\"mailto:support@webkul.com\">support@webkul.com<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, we are going to learn, How to apply a transformation to an email template from an external module. We can apply our own transformation to the content from our module. We can add multiple content transformation. To implement this feature we require you to know\u00a0How to add email layouts in a theme. <a href=\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":434,"featured_media":426085,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[209],"tags":[15342,256,2065,775,15343],"class_list":["post-426081","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-prestashop","tag-emails","tag-layout","tag-prestashop","tag-template","tag-transformation"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to apply a transformation to an email template from an external module - Webkul Blog<\/title>\n<meta name=\"description\" content=\"We can add multiple content transformation. To implement this feature we require you to know\u00a0How to add email layouts in a theme. After adding a customized layout to a theme. Here is an example of an email layout using the TransformationInterface.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to apply a transformation to an email template from an external module - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"We can add multiple content transformation. To implement this feature we require you to know\u00a0How to add email layouts in a theme. After adding a customized layout to a theme. Here is an example of an email layout using the TransformationInterface.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-05T13:42:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-05T07:17:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png\" \/>\n\t<meta property=\"og:image:width\" content=\"749\" \/>\n\t<meta property=\"og:image:height\" content=\"363\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ravindra Gautam\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ravindra Gautam\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/\"},\"author\":{\"name\":\"Ravindra Gautam\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/1a45b107e54bb2991c05f20fbb1dae12\"},\"headline\":\"How to apply a transformation to an email template from an external module\",\"datePublished\":\"2024-03-05T13:42:10+00:00\",\"dateModified\":\"2024-04-05T07:17:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/\"},\"wordCount\":444,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png\",\"keywords\":[\"Emails\",\"layout\",\"prestashop\",\"template\",\"Transformation\"],\"articleSection\":[\"prestashop\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/\",\"name\":\"How to apply a transformation to an email template from an external module - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png\",\"datePublished\":\"2024-03-05T13:42:10+00:00\",\"dateModified\":\"2024-04-05T07:17:41+00:00\",\"description\":\"We can add multiple content transformation. To implement this feature we require you to know\u00a0How to add email layouts in a theme. After adding a customized layout to a theme. Here is an example of an email layout using the TransformationInterface.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png\",\"width\":749,\"height\":363,\"caption\":\"Screenshot11\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to apply a transformation to an email template from an external module\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/1a45b107e54bb2991c05f20fbb1dae12\",\"name\":\"Ravindra Gautam\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1b8439e2774cf21a264df535ff994154071e538a17da7dc76beb9f7ffa28fa19?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1b8439e2774cf21a264df535ff994154071e538a17da7dc76beb9f7ffa28fa19?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Ravindra Gautam\"},\"description\":\"Ravindra is a Software Engineer in PrestaShop platform with expertise in Marketplace Development services. He excels in creating and managing online stores using PrestaShop, leveraging his skills in JavaScript, jQuery, and Web Services to deliver dynamic, user-friendly e-commerce solutions that drive business success.\",\"url\":\"https:\/\/webkul.com\/blog\/author\/ravindra-gautam192\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to apply a transformation to an email template from an external module - Webkul Blog","description":"We can add multiple content transformation. To implement this feature we require you to know\u00a0How to add email layouts in a theme. After adding a customized layout to a theme. Here is an example of an email layout using the TransformationInterface.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/","og_locale":"en_US","og_type":"article","og_title":"How to apply a transformation to an email template from an external module - Webkul Blog","og_description":"We can add multiple content transformation. To implement this feature we require you to know\u00a0How to add email layouts in a theme. After adding a customized layout to a theme. Here is an example of an email layout using the TransformationInterface.","og_url":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2024-03-05T13:42:10+00:00","article_modified_time":"2024-04-05T07:17:41+00:00","og_image":[{"width":749,"height":363,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png","type":"image\/png"}],"author":"Ravindra Gautam","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ravindra Gautam","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/"},"author":{"name":"Ravindra Gautam","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/1a45b107e54bb2991c05f20fbb1dae12"},"headline":"How to apply a transformation to an email template from an external module","datePublished":"2024-03-05T13:42:10+00:00","dateModified":"2024-04-05T07:17:41+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/"},"wordCount":444,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png","keywords":["Emails","layout","prestashop","template","Transformation"],"articleSection":["prestashop"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/","url":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/","name":"How to apply a transformation to an email template from an external module - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png","datePublished":"2024-03-05T13:42:10+00:00","dateModified":"2024-04-05T07:17:41+00:00","description":"We can add multiple content transformation. To implement this feature we require you to know\u00a0How to add email layouts in a theme. After adding a customized layout to a theme. Here is an example of an email layout using the TransformationInterface.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot11.png","width":749,"height":363,"caption":"Screenshot11"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-apply-a-transformation-to-an-email-template-from-an-external-module\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to apply a transformation to an email template from an external module"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/1a45b107e54bb2991c05f20fbb1dae12","name":"Ravindra Gautam","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1b8439e2774cf21a264df535ff994154071e538a17da7dc76beb9f7ffa28fa19?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1b8439e2774cf21a264df535ff994154071e538a17da7dc76beb9f7ffa28fa19?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Ravindra Gautam"},"description":"Ravindra is a Software Engineer in PrestaShop platform with expertise in Marketplace Development services. He excels in creating and managing online stores using PrestaShop, leveraging his skills in JavaScript, jQuery, and Web Services to deliver dynamic, user-friendly e-commerce solutions that drive business success.","url":"https:\/\/webkul.com\/blog\/author\/ravindra-gautam192\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/426081","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/434"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=426081"}],"version-history":[{"count":3,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/426081\/revisions"}],"predecessor-version":[{"id":431936,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/426081\/revisions\/431936"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/426085"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=426081"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=426081"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=426081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}