Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    The plugin you are referring to appears to be storing the pickup time as a unix timestamp in the order meta _local_pickup_time_select.
    We have some examples on how to print external data like delivery dates in our documentation.
    Here’s one of the examples modified to the above meta field, converting the timestamp to date + time:

    
    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_pickup_time', 10, 2 );
    function wpo_wcpdf_pickup_time ($template_type, $order) {
        // get the Pickup time from the order
        if ( $pickup_time = $order->get_meta('_local_pickup_time_select'); ) {
            // convert the Pickup time to a human readable format (using the WooCommerce/WordPress date format settings)
            $formatted_pickup_time = date_i18n( wc_date_format().' '.wc_time_format(), $pickup_time );
            ?>
            <tr class="pickup-time">
                <th>Pickup time:</th>
                <td><?php echo $formatted_pickup_time; ?></td>
            </tr>
            <?php
        }
    }
    

    Hope that helps!

    Thread Starter choutin

    (@choutin)

    Thank you I fixed the problem with the action hook
    add_action( ‘wpo_wcpdf_after_order_data’, ‘wpo_wcpdf_pickup_time’, 10, 2 );
    function wpo_wcpdf_pickup_time ($template_type, $order) {
    #my code
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘time not display’ is closed to new replies.