Hi @keeslamper,
Try with this code snippet:
/**
* PDF Invoices & Packing Slips for WooCommerce:
* Show the footer only for specific products in the order
*/
add_filter( 'wpo_wcpdf_footer_settings_text', function( $footer, $document ) {
$products_ids = array( 123, 321 ); // Enter here the product IDs separated by commas
if ( $order = $document->order ) {
foreach( $order->get_items() as $item_id => $item ) {
if ( in_array( absint( $item['variation_id'] ), $products_ids ) || in_array( absint( $item['product_id'] ), $products_ids ) ) {
return $footer;
}
}
}
return;
}, 10, 2 );
If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters
Hi,
I made a code snippet with the code snippet plugin, but i get an error, can you tell me how to fix it?
Snippet automatically deactivated due to an error on line 8:
Syntax error, unexpected token “return”.
Are you, by any chance, copying the code snippet from the email notification? If so, please return to the topic on ww.wp.xz.cn, and copy the code snippet from here.
Hi @keeslamper,
Since we haven’t heard back from you in the last two weeks, we’re assuming you solved this issue, so I’ll go ahead and mark this ticket as Resolved.
Feel free to reply to this topic is you still need help with this, or open a new topic if you have any other questions!