Use product tag for mpn in structured data

lituoklis
Visitor
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

Replies 2 (2)

gina-gregory
Shopify Expert
742 51 211

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 }}"
lituoklis
Visitor
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.