Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EmailPlugin: Allow dynamic Email templates #2044

Closed
martijnvdbrug opened this issue Feb 21, 2023 · 1 comment
Closed

EmailPlugin: Allow dynamic Email templates #2044

martijnvdbrug opened this issue Feb 21, 2023 · 1 comment
Assignees

Comments

@martijnvdbrug
Copy link
Collaborator

martijnvdbrug commented Feb 21, 2023

Is your feature request related to a problem? Please describe.
Similar to #2043, I would like administrators to edit/create templates from the Admin UI.

Describe the solution you'd like
It would be great to allow async fetching of templates. Something like:

    EmailPlugin.init({
      ...,
      templates: async (ctx, type) => {
        if (type === 'order-confirmation') {
          // Get, create or fetch my order-confirmation template from wherever I want
        }
        return {
          templateString: `<html>My handlebars template </html>`
        }
    })

This way we can get templates from the database based on the request context and event type, or even from external platforms (Some WYSIWYG handelbars SaaS? Just ideas...)

Describe alternatives you've considered
There currently is no way of doing this I think.

I would like to hear your thoughts on this. Is this something that should be included in Vendure, or is this a use case for a separate plugin?

Additional context

This would also remove the need for addTemplate(), since the strategy pattern above also allows for selecting templates based on language and/or channels (and more). That would make it a breaking change though..

@martijnvdbrug martijnvdbrug changed the title Allow dynamic Email templates EmailPlugin: Allow dynamic Email templates Feb 21, 2023
@martijnvdbrug
Copy link
Collaborator Author

For future reference @is0utfitters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants