title: WP-Woocommerce internal server error 500 code snippet
body: <p>When I add this code to functions.php
  I get internal server error....
  what's wrong?</p>
  
  <p>Purpose of the snippet: This code is to replace prices in products that have variations (price 1, price 2) it will output "from 1$" showing the lower price... </p>
  
  <p>after debbuging got this from the log:</p>
  
  <pre><code> PHP Warning: Cannot modify header information - headers already sent by (output started at /home/organicb/public_html/wp-content/themes/flatsome-child/functions.php:20) in /home/organicb/public_html/wp-includes/pluggable.php
  </code></pre>
  
  <p>snippet was found in <a href="https://gist.github.com/kloon/8981075" rel="nofollow">https://gist.github.com/kloon/8981075</a></p>
  
  <pre><code> // Use WC 2.0 variable price format, now include sale price strikeout
      add_filter( 'woocommerce_variable_sale_price_html', 'wc_wc20_variation_price_format', 10, 2 );
      add_filter( 'woocommerce_variable_price_html', 'wc_wc20_variation_price_format', 10, 2 );
      function wc_wc20_variation_price_format( $price, $product ) {
          // Main Price
          $prices 
          = array( $product-&gt;get_variation_price( 'min', true ), $product-&gt;get_variation_price( 'max', true ) );
          $price = $prices[0] !== $prices[1] ? sprintf( __( 'Desde: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
          // Sale Price
          $prices = array( $product-&gt;get_variation_regular_price( 'min', true ), $product-&gt;get_variation_regular_price( 'max', true ) );
          sort( $prices );
          $saleprice = $prices[0] !== $prices[1] ? sprintf( __( 'Desde: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
  
          if ( $price !== $saleprice ) {
              $price = '&lt;del&gt;' . $saleprice . '&lt;/del&gt; &lt;ins&gt;' . $price . '&lt;/ins&gt;';
          }
          return $price;}
  </code></pre>