Skip to content

Instantly share code, notes, and snippets.

@kilbot
Last active August 29, 2017 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kilbot/88cbd3ac5613eca90eea to your computer and use it in GitHub Desktop.
Save kilbot/88cbd3ac5613eca90eea to your computer and use it in GitHub Desktop.
Custom barcode example for WooCommerce POS
<?php
// this would go in your theme functions.php file
/**
* Custom product meta field to use as barcode
*
* By default WooCommerce POS will use the SKU field- '_sku'
* You can change the meta key using the following WordPress filter
*
* Below are meta fields from popular barcode plugins
* '_ywbc_barcode_value' - YITH WooCommerce Barcodes Premium
*/
function my_custom_pos_barcode_meta_key(){
return '_barcode'; // change for your custom meta key
}
add_filter('woocommerce_pos_barcode_meta_key', 'my_custom_pos_barcode_meta_key' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment