Home › Forums › EAN and Barcodes for WooCommerce › EAN and WPOvernight PDF Invoices › Reply To: EAN and WPOvernight PDF Invoices
February 9, 2022 at 7:51 pm #85076
If anyone else is interested, we’ve solved it by adding “Custom function” item column (in “WooCommerce > PDF Invoices > Customizer > Invoices”). There we’ve set “Function name” to my_alg_wc_ean_wpo_wcpdf
. And finally, we’ve added this snippet to the site – it will display EAN and 1D barcode:
if ( ! function_exists( 'my_alg_wc_ean_wpo_wcpdf' ) ) { function my_alg_wc_ean_wpo_wcpdf( $item ) { if ( ! empty( $item['item_id'] ) && ( $item = new WC_Order_Item_Product( $item['item_id'] ) ) && false !== ( $ean = alg_wc_ean()->core->get_ean_from_order_item( $item ) ) ) { $barcode = '<div class="ean_wrapper">' . alg_wc_ean()->pro->barcode->get_barcode_img( $ean, array( 'dim' => '1d', 'id' => alg_wc_ean()->core->ean_key . '_barcode_img', 'class' => 'ean-barcode', 'w' => 1, 'h' => 20, 'product_id' => alg_wc_ean()->core->get_order_item_product_id( $item ), ) ) . '</div>'; return $ean . $barcode; } } }