title: In Woocommerce page, script working only if executed in console
body: <p>In a Woocommerce page, I want to hide certain products if they have a badge (a class). I can't simply hide them because if i do, they won't show up as up-sells in the individual products page. So I tried with jQuery, if I type in the console:</p>
  
  <pre><code>var liSet = $("body.term-flamboyants-lingerie li.animate");
  
       if ( $("body.term-flamboyants-lingerie li.animate a").hasClass("setBadge") ){
          liSet.css("display", "none");
       }
  </code></pre>
  
  <p>It works, the products with the badge that are in this particular page are hidden. The problem is that if I write this in my script.js file, it doesn't work. I have more code in "script.js" that is working just fine and it's all wrapped inside a "jQuery(document).ready(function ($) {" I'm a bit at a loss as to why it wouldn't work.</p>
  
  <p><em>Edit</em> A setTimeOut function works, so my code was running before that class was set in the page. Is there a better way?</p>