I've installed Barcode module and Commerce Barcode Scanner module. The first is for generete barcodes to products. The second is supposed to read barcode labels. I couldn't test Commerce Barcode Scanner yet because I don't have a Barcode Scanner by now.

But I've been searched how Commerce Barcode Scanner works and I don't find anything.

Do I have to position cursor in a specific field from front-end or back-end of my site or is really only necessary to stay in some page of my site to Commerce Barcode scanner redirect to the Product Display (as that is the behavior setted up by default in rules)?

  • hi caco,I need your help.I am trying to implement barcode module in my project.But I cannot able to add this.Can you please help me? Jan 5, 2015 at 6:18
  • Hi @SubhajyotiDe, I just follow the instructions in barcode module web page to install and enable it. What is your doubt? Be more specific please.
    – Caco
    Jan 5, 2015 at 21:05
  • I installed the barcode module.made changes in the admin.Then I added a form with a textfield.Then what to do? Jan 6, 2015 at 5:42
  • I checked the example page comes with the barcode module.but the example page is also not working.check the link link .There is no textbox for writing any text. But in the code showing there is a field,type 'Barcode'. Jan 6, 2015 at 5:49
  • In my case, I added a field type barcode in the my content type product. You do that in Administration > Content > Settings > Content types > YOUR PRODUCT TYPE > Manage fields (in Commerce Kickstart 2 menu). To see the barcode you have to show it in one of the displays available. Again in my case I put the field visible in Full Content display. If you to do not put the barcode field in a display, I think you cannot see it in frontend. Anyway the barcodes genereted stay in the folder that you've specified when you add the barcode field.
    – Caco
    Jan 8, 2015 at 21:20

2 Answers 2


No, you do not need focus on a specific input field. The code that listens for keystrokes is as follows:

$(document).bind('keydown', function(e) {

The module itself is quite small and self contained, so you shouldn't to my knowledge encounter any stability issues. From a high level standpoint the module does the following:

  • Listens for keystrokes on the website that happen in a user defined interval.
  • Creates a path at barcode-scanner/trigger-event/XXX to receive the barcode from the browser.
  • Triggers a rules event with the context of a product and product display.

You will need to configure a rule to respond to the barcode scans and you will also need to assign the "trigger commerce barcode events" appropriately, only users who are assigned that permission will be able to trigger the configured rules events.

If you would like to test the module without a barcode scanner on hand, visit "admin/commerce/barcode-scanner" and then set the "Keypress Interval" setting to something large like "5000". This will give you 5 seconds between each keypress before it is discounted as a "scan". This is because barcode scanners usually enter their keys in very fast, so it prevents normal use of the website from being detected as a scan.

Then simply type in your SKU and hit return to simulate a real barcode scan.

  • Finally I tested the module and it rocks. I used a simple barcode scanner and it reads fine the barcode, and redirect to Product Display. But I registered the barcode by Barcode module. So the field is of type barcode and not SKU field. Is there a way to configure redirection to Product Display by barcode field rather than SKU field?
    – Caco
    Aug 28, 2014 at 17:08
  • Glad the module could be of some use to you. Not out of the box, no. If you look at commerce_barcode_scanner.rules.inc:87, you'll see the product being loaded by the SKU, ready to be passed into rules.
    – Sam Becker
    Aug 30, 2014 at 11:26

You know that only 17 sites currently report using this module? And that last revision is reported to be from 2013-Oct-27? So it is old thing, and hardly used. I advise caution.

This bugreport suggest that all you need to do is to have focus anywhere on your page, and it will work... except when you hit the bug itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.