WooCommerce Order Barcodes generates a unique barcode for each order, which can be very useful for order management. The barcode will display in the order admin area and on things like packing slips (if you also have a packing slip plugin), but they’ll also show on customer emails and in the customer My Account area.
If you’re only using the barcodes for the internal processing of orders, you may not want the barcodes to be displayed on customer emails and in the My Account area. There aren’t any settings to remove the barcodes from these places, but they can be removed with a code snippet:
add_action( 'init', 'snippetpress_remove_woocommerce_barcodes', 9999 ); function snippetpress_remove_woocommerce_barcodes() { $WooCommerce_Order_Barcodes = WC_Order_Barcodes(); //Remove from My Account order view remove_action( 'woocommerce_order_details_after_order_table', array( $WooCommerce_Order_Barcodes, 'get_display_barcode'), 1 ); //Remove from customer emails remove_action( 'woocommerce_email_after_order_table', array( $WooCommerce_Order_Barcodes, 'get_email_barcode' ), 1); }
If you only want to remove the barcodes from one of these places, just remove the appropriate line in the code above.
Where to add the snippet?
The snippet should be placed at the bottom of the functions.php file of your child theme. Make sure you know what you’re doing when editing this file. Alternatively, you can use a plugin such as Code Snippets to add the custom code to your WordPress site. If you need further guidance on how to add the code, check out our post on How to Add WordPress Snippets.
Leave a Reply