How to Pass a Variable to Commerce Order Twig Template I have located commerce-order-receipt.html.twig in commerce/order/templates/ and I have copied it to my theme directory, properly overriding it. My basic changes all work.

Now I am trying to figure out how to pass my own variable to it. I can't figured out which hook_preprocess function I need to use in order to do this. I have figured out how the suggestion and original variables were made in commerce_order.module but this has not helped me hook into it and add more variables.

Can someone point me in the right direction?
I think this should work, in THEME_NAME.theme add

function THEME_NAME_preprocess_commerce_order_receipt(&amp;$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.