Sometimes we need to change the barcode based on our site needs, thanks to new filter hooks provide by the WPCargo plugin version 6.7.5 .
WPCargo has default barcode type of “128” and size of “60”. To customize the default barcode type and size is very simple.
Note: The following barcode type available list are the following:
- code128
- code12a
- code39
- code25
- codebar
Sample code to customize Barcode type and size in the theme functions.php file
// Copy and paste this code in you theme function.php file</p><p>
// In this sample code - change the barcode type into code25 and barcode size 120
add_action( 'after_setup_theme', function(){
global $wpcargo;
$wpcargo->barcode_type = 'code25';
$wpcargo->barcode_size = '120';
}, 100);
Sample code to customize Barcode type and size in the plugin file
// Change barcode type to 'code25'
add_filter('wpcargo_barcode_type', function(){
return 'code25';
});
// Change barcode size to 120
add_filter('wpcargo_barcode_size', function(){
return 120;
});