• Hello

    I would like to add a conditional note on the invoice triggered by checkbox on the Order Details page.

    The note should not be displayed by default, it should only appear on the invoice after the person who is processing the order checks the checkbox.

    Is it possible to do (probably using some other custom field plugin in combination with this one)?

    Thank you in advance for any reply or advice.

Viewing 1 replies (of 1 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi @bartekryt,

    That is certainly possible. Assuming the field is stored in the order meta you will need a small action hook like this:

    add_action( 'wpo_wcpdf_after_order_details', 'wpo_wcpdf_show_custom_note', 10, 2 );
    function wpo_wcpdf_show_custom_note ($template_type, $order) {
        if ( $template_type == 'invoice' && $order->get_meta( 'your_checkbox_field_name' ) == 1 ) {
            ?>
            <p>Your note goes here...</p>
            <?php
        }
    }

    Swap the ‘your_checkbox_field_name’ placeholder for the name of your field. This code snippet should be placed in the functions.php of your child theme. If you haven’t worked with code snippets or functions.php before please read the following guide: How to use filters

Viewing 1 replies (of 1 total)

The topic ‘Add conditional note on the invoice’ is closed to new replies.