The order entity is rendered with an extra copy of the billing profile

Created on 4 March 2018, over 6 years ago
Updated 20 April 2023, over 1 year ago

For any order type, although the Manage Display tab includes the billing profile, in addition a second copy of the billing profile is always silently attached to the order in any view mode. This means that:

  • If the billing profile is enabled in Manage Display, the information is rendered twice.
  • It is not possible to render an Order without the billing profile.

To reproduce:

  1. In the Order type Manage Display tab, in a custom view mode, disable all fields except, say, the order number.
  2. Add a Rendered entity field to the Orders view, set to render as that custom view mode.

You'll get the order number, and you'll also get the profile fields. Bah.

Use case: I am adding an extra field to the order via hook_entity_extra_field_info() to display semicolon-delimited data that the store admin can copy to a spreadsheet. We want that in a column of the Orders overview table (among other places).

🐛 Bug report
Status

Active

Version

2.0

Component

Order

Created by

🇳🇿New Zealand john pitcairn

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom adamps

    I am also hitting this as part of developing Symfony Mailer module, which enables the billing profile in Manage Display. I currently have a workaround with hook_preprocess_commerce_order().

    It's not clear to me why the code mentioned in the IS is needed, because the field renders perfectly well by the normal mechanisms. However I guess any fix would need to be careful not to break existing sites.

    A simple fix that would solve the duplicate rendering (but not the removal) is to avoid adding $variables['order']['billing_information'] is $variables['order']['billing_profile'] is already set.

    It would be great to have an idea of how we can move this one forward, thanks.

Production build 0.71.5 2024