WordPress.org

Support

Support » Plugins and Hacks » Display Sale End date in single product page

Display Sale End date in single product page

Viewing 1 replies (of 1 total)
  • Hi @janmalagucute, you can add below code to functions.php in your theme folder:

    add_filter( 'woocommerce_get_price_html', 'custom_price_html', 100, 2 );
    function custom_price_html( $price, $product ){
        global $post;
        $sales_price_to = get_post_meta($post->ID, '_sale_price_dates_to', true);
        if(is_single() && $sales_price_to != "")
        {
            $sales_price_date_to = date("j M y", $sales_price_to);
    
            return str_replace( '</ins>', ' </ins> <b>(Offer till '.$sales_price_date_to.')</b>', $price );
        }
        else
        {
            return apply_filters( 'woocommerce_get_price', $price );
        }
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Display Sale End date in single product page’ is closed to new replies.