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.

Like it.? Share it:

Comments are closed.