Check if referenced field exists in commerce product display I have to render different types of product (with different fields combinations) in a generic product display tpl file. 
I created an array with all possible field names (they all are referenced product:field_name) which passes through a 

if ($content[$my_field]){
  //some code
}


that is supposed to check if the field exists and then do things...

The problem is that it actually checks the existence of the field but shouts out a notice: undefined index warning for every field that is not present.

Is there a way to execute this check in a cleaner way?

Thanks!
If I understood your question correctly, you should check if that element exists; here's how:

if (isset($content[$my_field])) {
  //
}


This way if the field is not set, you won't get the undefined index error.