I'm just wondering if its possible to alter a field before loading.

Here is the situation.

Im using commerce kickstart.

When I'm in a product page(inner page or product details page), I want to change the value of field_my_field before it load up to the page.

In pseudocode: If field_my_field == "something" change field_my_field to "my custom value"

1 Answer 1


It is very easy! where do you want to display the field?

If it is a view, then you can use template_preprocess_views_view if it is a node, you can use hook_preprocess_node function to alter the values. where your content is going to be displayed?

Your Answer

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

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