WooCommerce Grid / List view

Undo any changes you’ve have made to the file, then add this at the top:

if ( jQuery.cookie( "gridcookie" ) != "grid" ) {
    jQuery.cookie( "gridcookie", "list", { path: "https://wordpress.stackexchange.com/" } );
} 

Update: Sounds like a FOUC. Let’s take a different approach – remove the code you added above & try adding the following to your theme’s functions.php:

add_action( 'woocommerce_after_shop_loop', 'wpse_71885_shop_loop_list_init' );

function wpse_71885_shop_loop_list_init() {
    ?>

<script type="text/javascript">
    jQuery( "ul.products" ).addClass( jQuery.cookie( "gridcookie" ) || "list" );
</script>

<?php
}

This will add the grid/list class to the product list immediately after it enters the document (as opposed to waiting for document ready).