Welcome to 16892 Developer Community-Open, Learning,Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a problem with a function in wordpress, I am using the woocommerce pdf invoices packaging slips plugin and I need to hide the some fields in the products when the VAT is 0, that is when it does not have, this works, the thing is that when I'm going to print invoices in batch (from the admin / orders tab) all the invoices are printed as if they did not have VAT, even if they do, that is, remove the element from the table, and I don't know what to do, here below I put the function, for who can help me, thanks.

add_action( 'wpo_wcpdf_after_order_details', 'wpo_wcpdf_tax_show_rules', 10, 2 );

function wpo_wcpdf_tax_show_rules ($template_type, $order) {

    

 if ( $order->get_total_tax() > 0 ) {

        ?>

        <!-- Termina php-->

         <style>

          body > table.order-details > tbody > tr > td.vat,

        body > table.order-details > thead > tr > th.vat,

        body > table.order-details > thead > tr > th.tax_rate,         

        body > table.order-details > tbody > tr > td.tax_rate,

        body > table.notes-totals > tbody > tr > td.no-borders.totals-cell > table > tfoot > tr.tax-line.first.last {

            display:table-cell;

          }

    </style>

        <!-- Comienza php-->

        <?php

    } else  if ( $order->get_total_tax() == 0 ) {

        ?>

        <!-- Termina php-->

         <style>

          body > table.order-details > tbody > tr > td.vat,

        body > table.order-details > thead > tr > th.vat,

        body > table.order-details > thead > tr > th.tax_rate,         

        body > table.order-details > tbody > tr > td.tax_rate,

        body > table.notes-totals > tbody > tr > td.no-borders.totals-cell > table > tfoot > tr.tax-line.first.last {

            display:none;

          }

    </style>

        <!-- Comienza php-->

        <?php

    } 

    

}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
4.9k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to 16892 Developer Community-Open, Learning and Share
...