Commerce order email override ignores changes to order type view

Created on 16 June 2023, over 1 year 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 over 1 year 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??

Production build 0.71.5 2024