Created
May 22, 2025 07:14
-
-
Save webtoffee-git/e4181b0468d2fd56e7c31807bf12d210 to your computer and use it in GitHub Desktop.
Code snippet to hide tax items from invoice document - By WebToffee
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php> //Do not copy this line of code | |
add_filter('wf_pklist_alter_template_html', 'wt_remove_tax_items_row_from_invoice', 10, 2); | |
function wt_remove_tax_items_row_from_invoice( $html, $template_type ) { | |
if ( $template_type === 'invoice' && strpos( $html, 'data-row-type="wfte_tax_items"' ) !== false ) { | |
// Only run regex if pattern likely exists | |
$html = preg_replace( | |
'/<tr[^>]*data-row-type="wfte_tax_items"[^>]*>.*?<\/tr>/is', | |
'', | |
$html | |
); | |
} | |
return $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment