• Resolved nick76

    (@nick76)


    Hello! A customer of mine needs to print a legal disclaimer on the invoices where client was eligible for VIES tax exemption (something like “no taxes were applied because of x law”).
    What I think I need to do is to check, in our custom template (ips pro user), if tax total is 0 and, if so, print that disclaimer.

    What I could figure out is this:
    if ( count( $order->get_tax_totals() ) === 0 ) {
    echo ‘<br>’ . __( ‘LEGAL NOTE HERE’ );
    return true;
    }

    which appears to work, but I don’t know if there is a different/more correct way to do this. Any suggestion?

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

    (@pomegranate)

    Hi!
    Check the documentation here: Example 2: Print a custom text after the order details table (3rd variation).

    This checks whether any tax was charged, and the order total is more than 0, but I think your method works just as well. As an additional check, if you also store the VAT Number in the order (for example as _vat_number), you could add that too:

    
    if ( $vat_number = $order->get_meta('_vat_number') ) {
        # order has vat number
    }
    

    Combining it with your method or the method from the documentation further waterproofs this.

    Hope that helps!

    Thread Starter nick76

    (@nick76)

    Thank you so much, I will try your suggestion asap.
    In the example you provide, you also define $order_total= $order->get_total() but you don’t use it in the following logic; is it needed?

    EDIT: nevermind, I had not scrolled the text XD

    • This reply was modified 5 years, 11 months ago by nick76.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditionally add a line to invoice’ is closed to new replies.