Commerce product Display fields settings

Public

Configure display settings for an instance of field for commerce product type

</> CopyGet raw version
php
  1. //My Custom Product Type
  2. $producttype = 'book_product';
  3.  
  4. //Field instances for hidding
  5. $instances = array();
  6. ($instances[] = field_info_instance('commerce_product', 'commerce_file', $producttype));
  7. ($instances[] = field_info_instance('commerce_product', 'commerce_license_type', $producttype));
  8. ($instances[] = field_info_instance('commerce_product', 'commerce_license_duration', $producttype));
  9.  
  10. $hidden = 'hidden';
  11. foreach ($instances as $instance) {
  12. $instance['display']['default']['type'] = $hidden;
  13. $instance['display']['line_item']['type'] = $hidden;
  14. $instance['display']['node_teaser']['type'] = $hidden;
  15. field_update_instance($instance);
  16. }