• Resolved alvaroguerra

    (@alvaroguerra)


    Hello,

    I need to reflect that the tax is 0% on my invoices. I have the zero rate configured on my products, but it is not reflected on the invoice. Can you help me?

    Thank you.

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

    (@dwpriv)

    You can do this with a custom snippet. Give this one a try

    /**
    * PDF Invoices & Packing Slips for WooCommerce:
    * Show a Tax row in totals' area, even if the order taxes are empty (blank or 0)
    */
    add_filter( 'wpo_wcpdf_woocommerce_totals', function( $totals, $order, $document_type ) {
    if ( empty( $order->get_total_tax() ) ) {
    $totals['tax']['label'] = __( 'Tax', 'woocommerce' );
    $totals['tax']['value'] = wc_price( 0 );
    }
    return $totals;
    }, 10, 3 );

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

    Thread Starter alvaroguerra

    (@alvaroguerra)

    Hi,

    Your code is great! The only thing is that it is automatically translated as “Impuesto” (in Spanish) and appears below the total. I would like it to be displayed before the total so that the invoice is correct, and to be called “TAX” so that it is 100% valid and legal.

    Could you help me?

    Thank you very much

    • This reply was modified 2 months, 2 weeks ago by alvaroguerra.
    Plugin Contributor dwpriv

    (@dwpriv)

    You can try replacing that snippet with this one

    add_filter( 'wpo_wcpdf_woocommerce_totals', function( $totals_data, $order, $document ) {
    if ( ! empty( $order ) && $document == 'invoice' ) {
    if ( empty( $order->get_tax_totals() ) ) {
    $no_vat[] = array(
    'tax' => '',
    'type' => 'total',
    'label' => 'TAX',
    'value' => sprintf('<span class="custom-tax">%s</span>', wc_price( $order->get_tax_totals() ) ),
    'class' => 'total',
    );
    $totals_data = $no_vat + $totals_data;
    }
    }
    return $totals_data;
    }, 10, 3 );

    Thread Starter alvaroguerra

    (@alvaroguerra)

    It’s perfect now!

    Thank you so much for your help ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.