Created
March 17, 2022 07:45
-
-
Save grantalltodavid/c83ec1870bf742073b387c9ba0284f0d to your computer and use it in GitHub Desktop.
Sliced Invoices: remove quantity field from frontend views
This file contains 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
add_filter( 'sliced_invoice_line_items_output', 'si20220317_sliced_invoice_line_items_output_custom' ); | |
function si20220317_sliced_invoice_line_items_output_custom( $output ) { | |
if ( preg_match_all('#<t[hd] class="qty">(.*?)</t[hd]>#', $output, $matches) ) { | |
$patterns = array(); | |
$replacements = array(); | |
foreach ( $matches[1] as $match ) { | |
$patterns[] = '#<t[hd] class="qty">'.$match.'</t[hd]>#'; | |
$replacements[] = ''; | |
} | |
$output = preg_replace($patterns, $replacements, $output); | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment