• krysteo

    (@krysteo)


    Hello,

    How to have the EAN code displayed in the PDF invoice ?

    Thanks

Viewing 1 replies (of 1 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @krysteo,

    Try this code snippet to display the EAN code after the item meta:

    /**
    * PDF Invoices & Packing Slips for WooCommerce:
    * Displays the EAN code after the item meta
    */
    add_action( 'wpo_wcpdf_after_item_meta', function( $document_type, $item, $order ) {
    if ( ! empty( $item ) && ( $product = $item['product'] ) ) {
    if ( ! empty( $ean_code = $product->get_global_unique_id() ) ) {
    echo '<div class="product-ean" style="font-size:7pt">EAN: ' . $ean_code . '</div>';
    }
    }
    }, 10, 3 );

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use code snippets.

    We also have a blog post here that you may find helpful about adding custom code to your site.

    Let me know whether it worked or you need more help!

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.