5

Where can i alter commerce product twig template variables? When i display commerce product mymodule_preprocess and mymodule_preprocess_entity never called.

Doesn't exist mymodule_preprocess_node(&variables) for commerce product entity?

Thanks Fabio

1 Answer 1

10

You can use hook_preprocess_commerce_product like so:

function mymodule_preprocess_commerce_product(&$variables) {
  $product = $variables['elements']['#commerce_product'];
  ...
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.