Google Search Console warnings Missing field Sku and No global identifier provided

New Member
2 0 0

I am getting "Missing field sku" and "No global identifier provided (e.g., gtin, mpn, isbn)" warnings from Google Search Console only when products are Out of Stock. I have the following code from FeedArmy in my product-template.liquid. Can anyone tell me how to edit this code to populate the SKU and GTIN for products that are out of stock? I realize these are "just warnings" from Google and not errors, but I'd like to resolve them. Thanks in advance for any help.

 

<!-- Copyright FeedArmy 2019 Version 2.23 -->
{% assign fa_current_variant = product.selected_or_first_available_variant %}
<script type="application/ld+json" data-creator_name="FeedArmy">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": "{{ product.title | strip_html | escape }}",
"url": "{{ shop.url }}{{ product.url }}",
{% if product.first_available_variant.sku != blank %}
"sku": "{{ product.first_available_variant.sku }}",
{% else %}
"sku": "{{ product.first_available_variant.id }}",
{% endif %}
{% if product.first_available_variant.barcode.size == 12 %}
"gtin12": {{ product.first_available_variant.barcode }},
{% endif %}
{% if product.first_available_variant.barcode.size == 13 %}
"gtin13": {{ product.first_available_variant.barcode }},
{% endif %}
{% if product.first_available_variant.barcode.size == 14 %}
"gtin14": {{ product.first_available_variant.barcode }},
{% endif %}
"brand": {
"@type": "Thing",
"name": "{{ product.vendor | escape }}"
},
"description": "{{ product.description | strip_html | escape | strip_newlines }}",
"image": "https:{{ product.featured_image.src | img_url: 'grande' }}",
{% if product.variants %}
"offers": {% if product.variants.size > 1 %}[{% endif %}
{
"@type" : "Offer",
"priceCurrency": "{{ shop.currency }}",
"price": "{{ fa_current_variant.price | money_without_currency | strip_html | remove: ',' }}",
"itemCondition" : "http://schema.org/NewCondition",
"availability" : "http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}",
"url" : "{{ shop.url }}{{ fa_current_variant.url }}",
"itemOffered" :
{
"@type" : "Offer",
{% if fa_current_variant.image %}
{% assign variant_image_size = fa_current_variant.image.width | append: 'x' %}
"image": "http:{{ fa_current_variant.image.src | img_url: variant_image_size }}",
{% endif %}
{% if fa_current_variant.title != blank %}
"name" : "{{ fa_current_variant.title | escape }}",
{% endif %}
{% if fa_current_variant.barcode.size == 12 %}
"gtin12": {{ fa_current_variant.barcode }},
{% endif %}
{% if fa_current_variant.barcode.size == 13 %}
"gtin13": {{ fa_current_variant.barcode }},
{% endif %}
{% if fa_current_variant.barcode.size == 14 %}
"gtin14": {{ fa_current_variant.barcode }},
{% endif %}
{% if fa_current_variant.sku != blank %}
"sku": "{{ fa_current_variant.sku }}",
{% endif %}
"url": "{{ shop.url }}{{ fa_current_variant.url }}"
}
}{% if product.variants.size > 1 %},{% endif %}

{% for variant in product.variants %}

{% if variant != product.selected_or_first_available_variant %}
{
"@type" : "Offer",
"priceCurrency": "{{ shop.currency }}",
"price": "{{ variant.price | money_without_currency | strip_html | remove: ',' }}",
"itemCondition" : "http://schema.org/NewCondition",
"availability" : "http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}",
"url" : "{{ shop.url }}{{ variant.url }}",
"itemOffered" :
{
"@type" : "Product",
{% if variant.image %}
{% assign variant_image_size = variant.image.width | append: 'x' %}
"image": "http:{{ variant.image.src | img_url: variant_image_size }}",
{% endif %}
{% if variant.title != blank %}
"name" : "{{ variant.title | escape }}",
{% endif %}
{% if variant.barcode.size == 12 %}
"gtin12": {{ variant.barcode }},
{% endif %}
{% if variant.barcode.size == 13 %}
"gtin13": {{ variant.barcode }},
{% endif %}
{% if variant.barcode.size == 14 %}
"gtin14": {{ variant.barcode }},
{% endif %}
{% if variant.sku != blank %}
"sku": "{{ variant.sku }}",
{% endif %}
"url": "{{ shop.url }}{{ variant.url }}"
}
}
{% unless forloop.last %},{% endunless %}
{% endif %}
{% endfor %}
{% if product.variants.size > 1 %}]{% endif %}

{% if product.metafields.spr.reviews %}
,"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": {{ product.metafields.spr.reviews | split: 'ratingValue" content="' | last | split: '"' | first | plus: 0 }},
"ratingCount": {{ product.metafields.spr.reviews | split: 'reviewCount" content="' | last | split: '"' | first | plus: 0 }}
}
{% endif %}
{% endif %}
}
</script>
<!-- Copyright FeedArmy 2019 Version 2.23 -->

0 Likes

Having reviewed your code, I'm not convinced what you provided is where Google Search Console is reporting the warnings.

 

The instances where SKU is used will not show when it is blank. I don't see any other conditions that could affect it.

 

Use the Structured Data Testing tool or provide one of your pages here so we can see it in the tool. Theme's can often put schema markup on non-primary product pages through sections like related products, which can produce any error like those you spoke of.

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping
0 Likes
Highlighted
New Member
2 0 0

Thank you very much for your reply!

 

Here is a link to a product that HAS the warning for missing SKU and no Global Identifier (out of stock item):

https://activeoutdoorgearonline.com/products/holosun-micro-red-dot-sight-20mm-side-battery-auto

 

Here is a link to a product that does NOT HAVE the warning (in stock item):

https://activeoutdoorgearonline.com/products/gpo-binocular-passion-hd-10x42hd-black

 

I appreciate any insight you can provide!

0 Likes