Order Item fields on reciept

Created on 4 November 2024, about 2 months ago

Describe your bug or feature request.

Currently Commerce Order provides a template for receipts.
This shows for each order item, the quantity the label and the total price.

To customise this output either requires altering the label or customising the template. If you want to customise the template in multiple modules this becomes difficult.

Case:

Two custom modules each create a product type and have related order_item types. For each we want to display various fields onto the receipt - in one case we have a membership and we want to indicate if the membership is a gift the associated contact, in the other we have a custom payment and we want to show the text field which generates the custom payment. One module is specific to one site, the other is shared across multiple and intergrates with CiviCRM ( https://www.drupal.org/project/civicrm )

Possible Solution

Define a new View mode - Receipt. This would allow admins to define what fields should show for which order types on receipts. In twig you then could easily create templates to conditionally render based on order item type for example.

Potentially worth replicating this at an order type level as well.

I've managed an implementation of this via twig_tweak by using their drupal_entity twig filter.

This then gives us the expected twig templates to render fields, and entities.

which we can then generate relevant templates for.

Feature request
Status

Active

Version

3.0

Component

Order

Created by

🇳🇿New Zealand luke.stewart

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

Comments & Activities

Production build 0.71.5 2024