Commerce order email override ignores changes to order type view

Created on 16 June 2023, about 2 years ago

Problem/Motivation

I attempted to implement the override for commerce order emails but no matter what I do to the order type display 'email' the changes are not reflected in the email. I did clear the cache. Also, what is being displayed does not correspond to any of the displays on the order type. I only have one order type, default.

🐛 Bug report
Status

Active

Version

1.3

Component

Code

Created by

🇺🇸United States rhovland Oregon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @rhovland
  • 🇺🇸United States rhovland Oregon
  • Status changed to Postponed: needs info about 2 years ago
  • 🇬🇧United Kingdom adamps

    Thanks for the report. Please describe exactly what you did, what you saw, and what you expected to see.

  • 🇺🇸United States rhovland Oregon
  • 🇺🇸United States rhovland Oregon

    Added further explanation and tested in a base install with only commerce and symfony_mailer

  • 🇺🇸United States djween

    I am experiencing same as rhovland. The emails render the value for the "Order Log" field whether I have any display items fields enabled or not in the manage display tab for my order type.

  • 🇺🇸United States djween

    I even removed the body element and assumed it would revert back to using commerce's template (commerce-order-receipt.html.twig). However it did not. When an order confirmation email gets sent it still renders in the email the values from order.activity. This is an issue in of itself as this is admin data exposed to non-admin users via the email.

  • 🇬🇧United Kingdom adamps

    Strange - it works for me.

  • 🇺🇸United States djween

    It is happening when I have the {{ body }} tag in the body element. Not sure how to pull in the display fields from 'Order Types > Edit Default > Manage Display > Email' in to the body element. Using {{ body }} in the mailer policy is just pulling in order.activity but that is not being referenced from the manage display fields and the manage display fields that are enabled aren't being pulled in to the email.

  • 🇩🇪Germany Anybody Porta Westfalica

    Isn't this a problem / feature request in Drupal commerce, that needs a setting to select the view mode for order confirmation emails? Falling back to default, if none set?

  • 🇩🇪Germany Anybody Porta Westfalica

    I created an issue for that, as we ran into the same issue: Add a view mode selection for commerce order confirmation emails (by order type) Active Still I'm not sure, if we're all taking about the same thing.
    If yes, please move this over to commerce and close this as duplicate.

  • 🇬🇧United Kingdom adamps

    Add a view mode selection for commerce order confirmation emails (by order type) Active was closed by the maintainer because by default Commerce doesn't use an entity view mode to create the emails.

    This issue is about the case where the commerce order override is enabled (see IS point 3), which changes everything. Now the emails are built using an entity view. The variable {{ body }} will be replaced with the order entity rendered using the "email" view mode. Is it possible that the people seeing this bug are changing the wrong view mode?? (This module creates that view mode via the file config/mailer_override/core.entity_view_mode.commerce_order.email.yml.)

    Ah no but #9 is very clear, it mentions 'Order Types > Edit Default > Manage Display > Email'

    NB The "Order items" field defaults to use the "Order Item Table" formatter, which gets its output from a view. If you have strange unexpected markup then perhaps it comes from this view??

  • 🇮🇪Ireland gearoidocathain

    Hi!

    I am having a similar issue.

    When I override the Commerce Order mails in Mailer after installing Symfony Mailer. All commerce receipt emails contain the "Activity Log". There is no way to remove this via the Manage Display:

    E.G. Go to
    admin/commerce/config/order-types/default/edit/display/email
    i.e.
    Administration > Commerce > Configuration > Order types > Edit > Default > Manage display > Email

    Remove ALL fields from the display.

    In the Mailer Policy for
    Type
    Commerce order
    Subtype
    *All*
    Entity
    *All*

    Where the only element is "Body" and the only text in the body field is "{{ body }}".

    The resulting receipt email contains random fields but also the full list of all Activty that is Shown under "Order Activity" on the Order Admin page.

    Has anyone found a way to implement HTML emails correctly using Symfony Mailer (DMS+) for Drupal?

    Thanks,
    G

Production build 0.71.5 2024