Closed (fixed)
Project:
Commerce Core
Version:
8.x-2.9
Component:
Commerce
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 Nov 2018 at 12:40 UTC
Updated:
2 Feb 2021 at 19:29 UTC
Jump to comment: Most recent
Comments
Comment #2
garyg commentedThis is an important question and someone must have an answer please.
I can find no documentation on what the variables are for the "order item types" that are created and linked to a "product variation type".
How can we make this data available in these templates?
commerce-order--user.html.twig
commerce-order-receipt.html.twig
Comment #3
vishal.sheladiya commentedI think this should work, in THEME_NAME.theme add
function THEME_NAME_preprocess_commerce_order_receipt(&$variables) {
$variables['test'] = "test";
}
Note: replace THEME_NAME with actual name of theme
Then doing {{ test }} should output "test".
Note: remember to flush all cache to see changes.
Comment #4
garyg commentedThanks, but not exactly what I meant.
For example
- have added fields to order-item-types and want to include the field values into the order receipt
- have added fields to the order-item and want t include those field values into the order receipt.
Comment #5
DavidLiverneaux commentedThe created fields will be automatically available in the template commerce-order-receipt.html.twig.
For exemple :
You create the field field_test.
You can use like this : {{ order_entity.field_test.value }}
Comment #6
jsacksick commented