If you are having issues with Gutenberg editor, please simply download official Classic editor plugin.
Haven't found you're looking for? Visit goodstore howto web

Save percent next to sale prices or instead "Sale!" badge

  • Hello,

    I added the following snippet of code on my child functions.php but nothing happens. Could you help me, please?

    // Add save percent next to sale item prices.
    add_filter( 'woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2 );
    function woocommerce_custom_sales_price( $price, $product ) {
      $percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 );
      return $price . sprintf( __(' Save %s', 'woocommerce' ), $percentage . '%' );
    }

    Let me know if you need more info. ;)

    Thanks!
  • All following comments are shown for registered users only!

    (1 next comment)