Converted UPC to gtin13 in product schema#916
Conversation
mgielecinski
commented
Jan 27, 2026
| Questions | Answers |
|---|---|
| Description? | Converted UPC to gtin13 by adding leading 0 |
| Type? | bug fix |
| BC breaks? | no |
| Deprecations? | no |
| Fixed ticket? | |
| Sponsor company | |
| How to test? |
There was a problem hiding this comment.
Hi @mgielecinski, I left a comment here, @kpodemski or @Hlavtox do you have an opinion on this?
| "mpn": "{if $product.mpn}{$product.mpn}{elseif $product.reference}{$product.reference}{else}{$product.id}{/if}" | ||
| {if $product.ean13},"gtin13": "{$product.ean13}" | ||
| {elseif $product.upc},"gtin13": "{$product.upc}" | ||
| {elseif $product.upc},"gtin13": "0{$product.upc}" |
There was a problem hiding this comment.
Hi @mgielecinski, I’m not an expert on product codes, but it seems we can use gtin12 instead. This appears to be valid according to Schema.org: https://schema.org/Product
| {elseif $product.upc},"gtin13": "0{$product.upc}" | |
| {elseif $product.upc},"gtin12": "{$product.upc}" |
There was a problem hiding this comment.
Hello @tblivet
I think we can use gtin12 for the UPC code, but I was suggesting this line
|
I agree with @tblivet, gtin12 is a better solution IMHO, adding a zero smells :D |
|
@mgielecinski @tblivet Is it allowed to use both gtin13 and gtin12 together? We could change the elseif into separate condition. |
But |
|
@mgielecinski @Hlavtox, I think we should go with something like this? |
| "sku": "{if $product.reference}{$product.reference}{else}{$product.id}{/if}", | ||
| "mpn": "{if $product.mpn}{$product.mpn}{elseif $product.reference}{$product.reference}{else}{$product.id}{/if}", | ||
| {if $product.ean13}"gtin13": "{$product.ean13}",{elseif $product.upc}"gtin13": "0{$product.upc}",{/if} | ||
| {if $product.ean13}"gtin13": "{$product.ean13}",{elseif $product.upc}"gtin12": "{$product.upc}",{/if} |
There was a problem hiding this comment.
Sorry, I hadn’t noticed that the code was in two different places. I believe sku, mpn, ean13, and upc inside the Offers type can be removed, as they are duplicates.
| {elseif $product.upc},"gtin13": "{$product.upc}" | ||
| {if $product.ean13},"gtin13": "{$product.ean13}"{/if} | ||
| {if $product.upc},"gtin12": "{$product.upc}"{/if} | ||
| {/if} |
There was a problem hiding this comment.
@mgielecinski Thanks for the changes, but you forgot to remove a {/if}.
| {/if} |
There was a problem hiding this comment.
ohhh.. 2 Fast 2 Furious 😆
|
I made changes but I still think that gtin13 should be changed to gtin because in the ean13 field we can enter a 14-digit code |
tblivet
left a comment
There was a problem hiding this comment.
Hmm, you’re right, let’s go with gtin for ean13. Sorry for the back and forth 😕
AureRita
left a comment
There was a problem hiding this comment.
|
PR merged, well done! Message to @PrestaShop/committers: do not forget to milestone it before the merge. |

