• Resolved edwongtx

    (@edwongtx)


    Hi there,

    I am currently using “WooCommerce Order Delivery” plugin to allow my customers to select their preferred date and timing.

    I wish to understand if it is possible for both PDF Invoice & the Packing Slip to reveal my customer’s delivery date and timing?

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @edwongtx

    It is possible. The easiest way is with our Premium Templates extension creating a custom block with the correct custom field {{_delivery_date}}.

    You can also display the custom field with a custom template or action hook, but will require code work.

    • This reply was modified 4 years, 11 months ago by alexmigf.
    Thread Starter edwongtx

    (@edwongtx)

    Hi there Alexmifg, thank you for the swift response.

    I’ve managed to get the delivery date reflected.

    How about the delivery time?

    Is there a custom field that I can use to reveal the time?

    Thank you.

    Plugin Contributor alexmigf

    (@alexmigf)

    Hello @edwongtx

    Try this one: _delivery_time_frame

    Thread Starter edwongtx

    (@edwongtx)

    Hi Alexmigf,

    is this what I should be inputting?

    add_action( ‘wpo_wcpdf_after_order_data’, ‘wpo_wcpdf_delivery_time_frame’, 10, 2 );
    function wpo_wcpdf_delivery_time_frame ($template_type, $order) {
    if ($template_type == ‘packing-slip’) {
    $document = wcpdf_get_document( $template_type, $order );
    ?>
    <tr class=”delivery-time-frame”>
    <th>Delivery Date:</th>
    <td><?php $document->custom_field(‘delivery_time_frame’); ?></td>
    </tr>
    <?php
    }
    }

    I tried it, and it has not worked.

    Thank you.

    Thread Starter edwongtx

    (@edwongtx)

    Hi Alexmigf,

    I’ve tried this too, and the time frame did not work either ??

    add_action( ‘wpo_wcpdf_after_order_data’, ‘wpo_wcpdf_delivery_date’, 10, 2 );
    function wpo_wcpdf_delivery_date ($template_type, $order) {
    if ($template_type == ‘packing-slip’) {
    $document = wcpdf_get_document( $template_type, $order );
    ?>
    <tr class=”delivery-date”>
    <th>Delivery Date:</th>
    <td><?php $document->custom_field(‘delivery_date’); ?></td>
    </tr>
    <tr class=”delivery-time-frame”>
    <th>Delivery Time:</th>
    <td><?php $document->custom_field(‘_delivery_time_frame’); ?></td>
    </tr>
    <?php
    }
    }

    Plugin Contributor alexmigf

    (@alexmigf)

    Hello @edwongtx

    Try this:

    add_action('wpo_wcpdf_after_order_data', 'wpo_wcpdf_delivery_date', 10, 2);
    function wpo_wcpdf_delivery_date($document_type, $order)
    {
    	if( !empty($order) && $document_type == 'invoice' ) {
    		if( $delivery_date = $order->get_meta('_delivery_date') ) {
    			echo '<div>Delivery Date: '.$delivery_date.'</div>';
    		}
    		if( $delivery_time = $order->get_meta('_delivery_time_frame') ) {
    			echo '<div>Delivery Time: '.$delivery_time['time_from'].' - '.$delivery_time['time_to'].'</div>';
    		}
    	}
    }
    Thread Starter edwongtx

    (@edwongtx)

    Thank you so much Alexmigf!

    It’s working great!

    Plugin Contributor alexmigf

    (@alexmigf)

    You’re welcome ??

    We will be happy if you could drop us a review.

    Have a nice day!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to I reveal delivery date & time on PDF Invoice / Packing Slip’ is closed to new replies.