In your plugins directory, you’ll have the Woocommerce Grid-List Toggle Plugin – go there, and open the following file:
assets > js > jquery.gridlistview.min.js
Put your cursor right at the end of the code there and paste in the code example from above. Save, upload and reload your page.
Good luck!