Adding a before and after text on discounted pricing
1 2 3 4 5 |
add_filter( 'woocommerce_format_sale_price', function( $price, $regular_price, $sale_price ) { $price = '<div><span>Normal price: </span><span>' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</span></div> <div><span>Discounted price: </span><span>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</span></div>'; return $price; }, 10, 3); |