How to programmatically set views format?
From your comments it sounds like you want to change the style_plugin from your theme.  You need to implement hook_views_default_views_alter() in your theme.

Something like this: 

function themename_views_default_views_alter(&amp;$views) {
 if (isset($views['commerce_products']) {
  $views['commerce_products']-&gt;display['default']-&gt;display_options['style_plugin'] = 'table';
 }
}


I'm not too familiar with commerce so you might not want to target the default display if that display is used elsewhere; you might just want to target the 'page' display.