Barcode | WordPress.org

I @gentlemako,

We have a very complete plugin that allows you to managed barcodes in WooCommerce: WooCommerce Ultimate Barcodes. This plugin is also compatible with WooCommerce PDF Invoices & Packing Slips.

That said, if you want to add a simple QR code with the order number, you can achieve it with this code snippet:

/**
 * WooCommerce PDF Invoices & Packing Slips:
 * Show a QR code encoding the order number after the shop address
 */
add_action( 'wpo_wcpdf_after_shop_address', function( $document_type, $order ) {
	printf( '<img src="https://chart.googleapis.com/chart?chs=125x125&cht=qr&chl=%s" />', $order->get_order_number() );
}, 10, 3 );

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

I used the QR Codes API from Google Charts to display the QR code, but if you prefer using a different QR codes provider, you can do it just following the same approach.

 

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.

Your Advertisement Here