fix: render EAN barcodes with the correct format - #14322
Open
TaciteOFF wants to merge 2 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14322 +/- ##
==========================================
+ Coverage 50.30% 55.49% +5.18%
==========================================
Files 103 104 +1
Lines 26398 26456 +58
Branches 6315 6324 +9
==========================================
+ Hits 13280 14681 +1401
+ Misses 11357 9850 -1507
- Partials 1761 1925 +164
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
JsBarcode refuses to render a value that does not validate against the requested format: it throws an InvalidInputException and nothing is drawn. Since codes assigned by assign_new_code() are sequential from 2000000000001, most of them have an invalid EAN-13 check digit, and so do codes entered with a typo. Forcing the EAN13/EAN8 format would have made their barcode disappear from the product page. Catch the exception and re-render with CODE128 in that case, which is what the previous "auto" format always used.
|
Freso
approved these changes
Aug 23, 2026
Freso
left a comment
Collaborator
There was a problem hiding this comment.
Looks good to me. Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Context
The product page currently uses JsBarcode with the
autoformat. JsBarcode does not detect EAN formats automatically: when Code 128 is available,autoselects it. As a result, a product such as 3600542656733 is labelled as EAN-13 but displayed as Code 128.The barcode is generated as an SVG in the browser, so this change does not require any product recomputation or data migration.
Tests
git diff --check3600542656733as EAN-13 and produces the expected 95-module encoding;