Hi @redair,
Try this code snippet I just wrote for you:
/**
* PDF Invoices & Packing Slips for WooCommerce:
* Limits the number of characters of the product SKU
*/
add_filter( 'wpo_wcpdf_html_filters', function( $filters ) {
$filters[] = array( 'wpo_wcpdf_order_item_data', 'wpo_wcpdf_trim_long_sku', 999, 3 );
return $filters;
} );
function wpo_wcpdf_trim_long_sku( $data, $order, $document_type ) {
$char_limit = 10; // Set your desire limit here
$data['sku'] = substr( $data['sku'], 0, $char_limit );
return $data;
}
If you haven’t worked with code snippets (actions/filters) or functions.php
before, read this guide: How to use filters
I have set 10
as a limit within $char_limit
, but feel free to edit this value with the one you like, to limit the number of characters to be displayed.