• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
SnippetPress

SnippetPress

The Home of WordPress Snippets

Vultr Web Hosting
  • Cheat Sheets
  • Reviews
  • Snippets
  • Tutorials

WooCommerce Order Barcodes – Remove Barcode From Emails and My Account

June 26, 2020 by SnippetPress Leave a Comment

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.

Filed Under: Snippets, Snippets, WooCommerce

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

E-mail Newsletter

More to See

WooCommerce – Prevent Product Being Added To Cart If A Specific Product Is Already In Cart

July 15, 2020 By SnippetPress

WooCommerce – Display an “Add $X To Get Free Shipping” Notice

July 13, 2020 By SnippetPress

Footer

Recent

  • Change The WordPress Page Title Separator Without A Plugin
  • WooCommerce – Prevent Product Being Added To Cart If A Specific Product Is Already In Cart
  • WooCommerce – Display an “Add $X To Get Free Shipping” Notice
  • WooCommerce – Integrate Google Merchant Center Customer Reviews
  • WooCommerce – Disable Out of Stock Variations

Search

Copyright © 2023 ·SnippetPress