Woocommerce: Best way to insert Javascript in template files

sometimes it is necessary to insert jquery in template files. Instead of just writing the script tag straight away, use woocommerce built-in capability.

Say I want to modify fancybox behaviour in the product page to not display the title upon popup, I add this snippet in the single-product/product-image.php for example.

jQuery("a.zoom, a.show_review_form").fancybox({
'titleShow' : false,
$code = ob_get_clean(); 

Note that the fancy code example used here is ver 1.3. There are newer version by the time you read this.

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Sitecritic.net Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.