• playdiune

    (@playdiune)


    Hello,
    I use the next code to show, the line below the price on product page, the start and end promotional dates (necessary in Europe):

    // MOSTRA AS DATAS DE PROMO??O NA PAGINA DE ARTIGO SIMPLES
    function preco_informa_data_promocao( $price, $product ) {
    if ( is_single() && $product->is_on_sale() ) {
    $data_inicio = $product->get_date_on_sale_from();
    $data_fim   = $product->get_date_on_sale_to();
    if( ! empty($data_inicio) || ! empty($data_fim) ){
        $data_de_inicio   = $data_inicio->date( "j.m.Y");
        $data_de_fim = $data_fim->date( "j.m.Y");
        $sales_date = '<p class="desconto_produto">Promo??o válida de '.$data_de_inicio.' a '.$data_de_fim.'</p>';
    } else {
        $sales_date = $data_de_inicio = $data_de_fim = '';
    } 
        $price = "<p class='price'>" . $price ."</p>" . "<p style='text-align:center'>" . $sales_date ."</p>";
    }
    
    return $price;
    }
    add_filter( 'woocommerce_get_price_html', 'preco_informa_data_promocao', 100, 2 ); 

    I would like to adapt this code to be used with this plugin. But I need the name of the variables that store the discount dates. Basically these two values:

    $data_inicio = $product->get_date_on_sale_from();
    $data_fim   = $product->get_date_on_sale_to();

    It’s possible ? Thanks

    • This topic was modified 2 years ago by playdiune.
    • This topic was modified 2 years ago by playdiune.
    • This topic was modified 2 years ago by playdiune.
Viewing 1 replies (of 1 total)
  • Hello @playdiune,

    Thanks for reaching out.

    I have escalated this with our development team . They will get back to you as soon as they can.

    Kind regards,
    Moshtafizur

Viewing 1 replies (of 1 total)
  • The topic ‘Show Start and End Promotional Dates’ is closed to new replies.