Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Created May 22, 2025 07:14
Show Gist options
  • Save webtoffee-git/e4181b0468d2fd56e7c31807bf12d210 to your computer and use it in GitHub Desktop.
Save webtoffee-git/e4181b0468d2fd56e7c31807bf12d210 to your computer and use it in GitHub Desktop.
Code snippet to hide tax items from invoice document - By WebToffee
<?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