Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.9k views
in Technique[技术] by (71.8m points)

php - Problem hiding some elements in wordpress's woocommerce pdf invoices packaging slips plugin

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

    } 

    

}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...