• Resolved martintenboske

    (@martintenboske)


    Hi Support,

    I am using Woo delivery plugin for clients to select a delivery date and time.
    Now I would like to display delivery date and time to the Woocommerce PDF packing slip.
    Is there a code snippet to make this happen? Can you help me with this?

    Thanks! Martin

Viewing 1 replies (of 1 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hello @martintenboske,

    You can add custom fields to your invoices and packing slips using the template action hooks. See several examples about adding new fields to your invoices here.

    Let’s say your custom field is stored with the order meta key delivery_date, then you could add this field to your packing slips using the following code snippet:

    add_action( 'wpo_wcpdf_after_billing_address', 'wpo_wcpdf_delivery_date', 10, 2 );
    function wpo_wcpdf_delivery_date ($template_type, $order) {
    ? ? $document = wcpdf_get_document( $template_type, $order );
    ? ? if ($template_type == 'packing-slip') {
    ? ? ? ? ?>
    ? ? ? ? <tr class="delivery-date">
    ? ? ? ? ? ? <th>Delivery Date:</th>
    ? ? ? ? ? ? <td><?php $document->custom_field('delivery_date'); ?></td>
    ? ? ? ? </tr>
    ? ? ? ? <?php
    ? ? }
    }

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    You can also add any field, without no code, using Premium Templates. This extension includes a customizer that allows you to tailor your PDF documents using product columns, total rows, and custom blocks. In addition, Premium Templates provides two additional templates: Business and Modern.

    For your specific case, you only need to add a custom block this way:

    A screenshot that display an use example of the custom blocks

    Then, your invoices will display your custom field:

    A screenshot that display the example custom field on the invoice

    If you don’t know the name of your custom field, see Finding WooCommerce custom fields

    Let me know if you have more questions ??

Viewing 1 replies (of 1 total)
  • The topic ‘Delivery info on packing slip’ is closed to new replies.