• Resolved hillviewhp

    (@hillviewhp)


    I have at my checkout a yes/no box (if a customer will accept substitutions) which shows as “_additional_wooccm0” and gives me a yes/no answer.

    I’ve tried but failed to code a snippet to show this answer in the ‘notes’ box on the invoice (yes i just print invoices rather than packing lists) (So would read
    Auricula substitutions:
    Yes/No

    This way when picking the orders a) i know if i can pick subs, but also b ) so on the invoice customers can see they checked that box.

    Can someone please help me?! I’m losing the will…

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor dwpriv

    (@dwpriv)

    You can try the guide here to print a custom field onto the invoices

    Thread Starter hillviewhp

    (@hillviewhp)

    I tried to write something using that and just failed – but i’ll try again!!

    Thread Starter hillviewhp

    (@hillviewhp)

    Not perfect but this worked

    add_action( 'wpo_wcpdf_after_order_data', '_additional_wooccm0', 10, 2 );
    function _additional_wooccm0 ($template_type, $order) {
    if ($template_type == 'invoice') {
    ?>
    <tr class="auricula-substitutions">
    <th><b>Auricula Substitutions:</th>
    <td><?php echo $order->get_meta('_additional_wooccm0'); ?></b></td>
    </tr>
    <?php
    }
    }

    Plugin Contributor dwpriv

    (@dwpriv)

    You can check that the meta key exists before printing, like this updated snippet

    add_action( 'wpo_wcpdf_after_order_data', '_additional_wooccm0', 10, 2 );
    function _additional_wooccm0 ($template_type, $order) {
    if ( $template_type == 'invoice' && ! empty( $order->get_meta('_additional_wooccm0') ) ) {
    ?>
    <tr class="auricula-substitutions">
    <th><b>Auricula Substitutions:</th>
    <td><?php echo $order->get_meta('_additional_wooccm0'); ?></b></td>
    </tr>
    <?php
    }
    }
    Plugin Contributor dwpriv

    (@dwpriv)

    Since we haven’t heard from you in a while. I will mark this topic as resolved. Feel free to reopen it if you need more help or start another topic if you need help with something else.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.