How can I check if a node references a Drupal Commerce product?
There isn't a short function, though that's not a bad idea for a feature request. However, it's not that difficult using the Field Info API to determine if a given node contains a product reference field. One method would be using field_info_instances().

With this function and your node object, you can retrieve an array of all field instances on your node with the following code:

$instances = field_info_instances('node', $node-&gt;type);


You would then need to loop over the returned instances and use field_info_field($instance['field_name']) to load the field info array and see if the type of any given field is commerce_product_reference. If so, then you know the node can at least refer to a product... but that doesn't mean a reference is actually established.

For that you'd need to make sure the node contained data for that instance. That could be as simple as checking if (!empty($node-&gt;$instance_name)), but it'll depend on how you're actually building / using these reference fields.

One simpler way to find if a product reference instance is on the node is possible if you know your reference field's name. For that you can use field_read_instance() with the following code to return the info array of the instance or FALSE if it doesn't exist for the given node type:

$instance = field_read_instance('node', $field_name, $node-&gt;type);


Hope those help, and feel free to open an issue in the Commerce issue tracker for any related helper functions under the "Developer experience" component. I suggest you spend time getting to know the Field Info / CRUD APIs, as they'll be very helpful to you in your Drupal 7 development.