Created
March 20, 2018 07:29
-
-
Save psamsotha/99b4b6de94c89d5b48926f6fc7f2f697 to your computer and use it in GitHub Desktop.
Little script to disable shop links in Woocommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function disable_shop_item_buttons() { | |
print <<<JS | |
<script> | |
var links = document.getElementsByClassName('woocommerce-LoopProduct-link'); | |
for (var i = 0; i < links.length; i++) { | |
links[i].addEventListener('click', function (e) { | |
e.preventDefault(); | |
}); | |
} | |
</script> | |
JS; | |
} | |
add_action( 'woocommerce_after_shop_loop', 'disable_shop_item_buttons' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment