Use product tag for mpn in structured data

lituoklis
New Member
2 0 0

I want to resolve this: "This Product is missing a global identifier (e.g. isbn, mpn or gtin8)" for Google structured data. But Shopify does not have field MPN. Can i (and how to) set mpn to use first product tag? In my case there are three, first is vendor , second unique and represents manufacturers part number, third is type for category. Example: WesternDigital, WD5000BMVW, HDD

0 Likes
gina-gregory
Shopify Expert
644 37 140

If you want to use certain tags for specific purposes, it helps to add a prefix to your tag, like "mpn-1234567890". Then in your rich snippets code, you can get it like this:

{%- for tag in product.tags -%}
  {%- if tag contains 'mpn-' -%}
    {%- assign productMPN = tag | remove: 'mpn-' -%}
    {%- break -%}
  {%- endif -%}
{%- endfor -%}

Rich snippet ld+json code...
"mpn": "{{ productMPN }}"
0 Likes
lituoklis
New Member
2 0 0

Thank you, that's awesome answer. I am not programmer, but i dig it, however it's a lot of tags and collection rules to edit. Is it possible to modify code to use tag that has no XthatX, XorthatX, XoreventhatX? Because other tags tend to repeat, would be much easier to create "ignore" list.

0 Likes