How can I store barcodes in the PIM?

We advise you to select the attribute type ‘text’ to add barcodes (GTIN, EAN13, UPC…) in your PIM.

Thanks to the validation parameters available for all attribute types, you can add a regular expression to make sure that your codes will contain the exact number of digits required.

For instance, to store an EAN13 in Akeneo, which contains 13 digits, add a validation rule based on the following regular expression: /^[0-9]{13}$/

Store EAN13 codes in Akeneo


Was this article helpful?

Related Articles

  • geoffray Reboud

    it’s exactly what I have done, but it returns in my CSV file a thing like that : 1,23457E+12 …
    I’d like to export ean13 as a number but as a number in akeneo, it can’t have 13 digits… (max 10digits => returns 9999999999 while I filled 1234567890123 for 13digits ean13 example)

    • Laure Brosseau

      Hello Geoffray,
      Regarding the formatting, the display “1,23457E+12” is linked to the csv reader, it might have issues to read an EAN13 if it starts with a ‘0’.
      First step is to check if Akeneo exports the EAN code properly, open the exported CSV file in a txt editor like Notepad or TextEdit, you should see the right number exported “1234567891234”. If not, please send me your exact PIM version (1.7.4 for instance) as well as the attribute type you’re using and the right EAN code.
      I don’t understand the relationship with the RegEx for EAN code mentioned in our article and the fact that you cannot have more than 10 digits in Akeneo, natively there is no limitations. Did you specify a max number? Moreover RegEx are not available for number attribute types.
      Looking forward to hearing from you,

      • geoffray Reboud

        Hello !
        Actually, the right number is exported when I check with notepad++, and when I import (in prestashop) the CSV file without opening it with excel, the EAN13 isn’t changed by the default format of excel and… it’s working ; finally using a text attribute type with the validation RegEx ‘/^[0-9]{13}$/’
        I had to open the csv with excel (test values…) but i’m working to automate export/import and mapping actions between the PIM and the B.O. so it’s no more a problem.
        Thanks for your help !! =)