How to Hide Added to Cart message in WooCommerce

Update for WooCommerce 3+ The hook wc_add_to_cart_message is deprecated and replaced by wc_add_to_cart_message_html. You can use the following (compact effective way): [php]add_filter( ‘wc_add_to_cart_message_html’, ‘__return_false’ );[/php] Or the normal way: [php]add_filter( ‘wc_add_to_cart_message_html’, ’empty_wc_add_to_cart_message’); function empty_wc_add_to_cart_message( $message, $products ) { return ”; }; [/php] Before WooCommerce 3, use this: Removing only the message (pasting it to your function.php file inside … Read more

How to add a simple jQuery script to WordPress?

First you need to write your script. In your theme folder create a folder called something like ‘js’. Create a file in that folder for your javascript. E.g. your-script.js. Add your jQuery script to that file (you don’t need <script> tags in a .js file). Here is an example of how your jQuery script (in wp-content/themes/your-theme/js/your-scrript.js) might … Read more

TypeError: ‘undefined’ is not a function (evaluating ‘$(document)’)

WordPress uses jQuery in noConflict mode by default. You need to reference it using jQuery as the variable name, not $, e.g. use [sourcecode language=”plain”]jQuery(document);[/sourcecode] [custom-related-posts title=”You may Also Like:” none_text=”None found” order_by=”title” order=”ASC”]

In WordPress How to Use jquery and $ Sign

By default when you enqueue jQuery in WordPress you must use jQuery, and $ is not used (this is for compatibility with other libraries). Your solution of wrapping it in function will work fine, or you can load jQuery some other way (but that’s probably not a good idea in WordPress). If you must use document.ready, you can actually pass $ into … Read more