Adding One Line Below Weight

[ad_1]

Hello @agusapri,

Do you by any chance know the meta key under which the barcode is saved in the order? Finding WooCommerce Custom Fields

Is this an order barcode or a product barcode?
Displaying Product custom fields
Displaying Custom fields

It’s Product Barcode.

Please see this screenshot, https://kutabali.my.id/Screenshot.png for Order Post Meta Key (I am not sure how tell you).

Thanks for confirming that it is a product barcode, @agusapri!

Please try adding this code snippet to display the product barcode after the item meta:

/**
 * PDF Invoices & Packing Slips for WooCommerce:
 * Add the product barcode (number) after the item meta
 */
add_action( 'wpo_wcpdf_after_item_meta', function( $template_type, $item, $order ) {    
    if ( isset( $item['product'] ) && ! empty( $barcode = $item['product']->get_meta( 'barcode' ) ) ) {
        echo "<div class=\"barcode\">Barcode: {$barcode}</div>";
    }
} , 10, 3 );

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

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer