title: Set product sale price programmatically in WooCommerce 3
body: <p>I have a Woocommerce store set up with various product categories. </p>
  
  <p>I want to apply a 20% discount to all products, which belong to the product category <strong>Cuckoo</strong></p>
  
  <p>For now all I'm trying to achieve is set a sale price in my <strong>functions.php</strong></p>
  
  <p>It tried as follows:</p>
  
  <pre><code>    /* 
       * For a specific date, 20% off all products with product category as cuckoo clock.
       */
      function cuckoo_minus_twenty($sale_price, $product) { 
          $sale_price = $product-&gt;get_price() * 0.8;
          return $sale_price;
      }; 
  
      // add the action 
      add_filter( 'woocommerce_get_sale_price', 'cuckoo_minus_twenty', 10, 2 ); 
  </code></pre>
  
  <p>If I var_dump the result of $sale_price after the calculation I get the correct answer, however the price display on the front-end strikes out the regular price and displays the sale price as the regular price.</p>
  
  <p><a href="https://i.stack.imgur.com/thWGJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/thWGJ.png" alt="enter image description here"></a></p>
  
  <p>Is there a hook/filter I can use to achieve this?</p>
  
  <p>I've also tried setting the sale price by doing:</p>
  
  <pre><code>$product-&gt;set_sale_price($sale_price); 
  </code></pre>
  
  <p>to no avail.</p>