Add the order barcode in a third party document
You can add the order barcode in a third party document like an invoice or packing slip adding the next code in the functions.php of your active theme.
if ( ! function_exists( 'yith_wc_barcodes_and_qr_filter_call_back' ) ) {
function yith_wc_barcodes_and_qr_filter_call_back( $order_id ){
ob_start();
$css = ob_get_clean();
YITH_YWBC()->show_barcode( $order_id, true, $css );
}
add_action( 'yith_wc_barcodes_and_qr_filter','yith_wc_barcodes_and_qr_filter_call_back', 10, 1 );
}
Then, you have to add the next hook where you like inside templates where you want to display the barcode.
do_action ( 'yith_wc_barcodes_and_qr_filter', $order_id );
Where the $order_id variable should be modified depending on how the order ID is retrieved on the template.
For example, in many cases, you should replace $order_id by $this->order->get_id()