Solved

how to fix: Missing field "shippingDetails" (in "offers")

Shawn512
Shopify Partner
111 2 15

Shawn512_0-1685682219782.png

Missing field "hasMerchantReturnPolicy" (in "offers")

Missing field "shippingDetails" (in "offers")

 

I found these two issues in Google Search Console. How can I resolve them? Can I directly add the corresponding structured data code in the product JSON file? If yes, what should be the code? Thank you.

Pet Travel Supplies Small Business
Accepted Solution (1)

magecomp
Shopify Partner
264 20 31

This is an accepted solution.

Hello @Shawn512 

 

To resolve this issue, you need to add the following code to your product JSON file:

 
"hasMerchantReturnPolicy": {
  "value": true
}
 

This code will tell Google that your product has a merchant return policy.

Missing field "shippingDetails" (in "offers")

To resolve this issue, you need to add the following code to your product JSON file:

 
"shippingDetails": {
  "type": "FreeShipping",
  "price": "0"
}

This code will tell Google that your product offers free shipping.

Here is an example of a complete product JSON file with the required structured data:

{
  "id": "123456",
  "title": "Product Name",
  "description": "Product Description",
  "price": "100.00",
  "currency": "USD",
  "image": "https://example.com/product.jpg",
  "availability": "InStock",
  "offers": [
    {
      "url": "https://example.com/product-123456",
      "price": "100.00",
      "currency": "USD",
      "quantity": "1",
      "hasMerchantReturnPolicy": {
        "value": true
      },
      "shippingDetails": {
        "type": "FreeShipping",
        "price": "0"
      }
    }
  ]
}
 
Helping voluntarily. Please like and accept the solution if it helps. Thanks!
Our Bestseller Shopify Apps    |      Mobile App Builder by MageComp    |      Limit Qty Purchase

Need a developer?  Just visit MageComp website

View solution in original post

Replies 7 (7)

magecomp
Shopify Partner
264 20 31

This is an accepted solution.

Hello @Shawn512 

 

To resolve this issue, you need to add the following code to your product JSON file:

 
"hasMerchantReturnPolicy": {
  "value": true
}
 

This code will tell Google that your product has a merchant return policy.

Missing field "shippingDetails" (in "offers")

To resolve this issue, you need to add the following code to your product JSON file:

 
"shippingDetails": {
  "type": "FreeShipping",
  "price": "0"
}

This code will tell Google that your product offers free shipping.

Here is an example of a complete product JSON file with the required structured data:

{
  "id": "123456",
  "title": "Product Name",
  "description": "Product Description",
  "price": "100.00",
  "currency": "USD",
  "image": "https://example.com/product.jpg",
  "availability": "InStock",
  "offers": [
    {
      "url": "https://example.com/product-123456",
      "price": "100.00",
      "currency": "USD",
      "quantity": "1",
      "hasMerchantReturnPolicy": {
        "value": true
      },
      "shippingDetails": {
        "type": "FreeShipping",
        "price": "0"
      }
    }
  ]
}
 
Helping voluntarily. Please like and accept the solution if it helps. Thanks!
Our Bestseller Shopify Apps    |      Mobile App Builder by MageComp    |      Limit Qty Purchase

Need a developer?  Just visit MageComp website
Shawn512
Shopify Partner
111 2 15

Shawn512_0-1685688688886.png


can I add the code to the theme code directly?

how to fix the problem i have?

 

Pet Travel Supplies Small Business
amirb55
Visitor
1 0 0

hi there i use wordpress and woocommerce in my site but i dont know where is product jason file

please help me how can find this file?

Fahad_Ahmad
Excursionist
21 1 2

This code is not working on my website, can you please have a look 

(df0a69.myshopify.com)

EmmanuelFlossie
Shopify Partner
2979 222 716

Try:

 

<!-- Copyright FeedArmy 2023 Version 3.21 -->
<!-- FeedArmy tutorial found at https://feedarmy.com/kb/shopify-microdata-for-google-shopping/ -->

<!-- CODE SETTINGS START -->
<!-- CODE SETTINGS START -->

<!-- ALPHA2 CODE Please add your alpha2 code, you can find it here: https://help.shopify.com/en/api/custom-storefronts/storefront-api/reference/enum/countrycode -->
{%- assign fa_product_id_alpha2_code = 'US' -%}

<!-- PRODUCT IDset your product id values are default, product_id, parent_id, sku-->
{%- assign fa_product_id = 'default' -%}

<!-- RETURNS How long is your returns policy in days? -->
{%- assign fa_return_days = 28 -%}

<!-- SHIPPING How much do customer need to spend for free returns, assign your currency? -->
{% if cart.currency.iso_code == 'USD' %}
    {%- assign fa_shipping_currency = "USD" -%}
    {% if fa_product_price >= "75" %}
        {%- assign fa_shipping_price = 0.00 -%}
    {%- else -%}
        {%- assign fa_shipping_price = 4.50 -%}
    {%- endif -%}
{%- endif -%}
{%- assign fa_shipping_handling_time_min = 0 -%}
{%- assign fa_shipping_handling_time_max = 1 -%}
{%- assign fa_shipping_shipping_time_min = 2 -%}
{%- assign fa_shipping_shipping_time_miax = 5 -%}

<!-- Disable / Enable shipping or returns true for enabled, false for disabled-->
{%- assign fa_returns = 'true' -%}
{%- assign fa_shipping = 'true' -%}

<!-- CODE SETTINGS END -->
<!-- CODE SETTINGS END -->

<!-- ==================================== -->
<!-- DO NOT EDIT ANYTHING BELOW THIS LINE -->

{%- if template contains 'product' -%}

{%- assign fa_current_variant = product.selected_or_first_available_variant -%}

{%- if fa_product_id == 'default' -%}
{%- capture fa_product_id_value -%}shopify_{{ fa_product_id_alpha2_code }}_{{ product.id }}_{{ fa_current_variant.id }}{%- endcapture -%}
{%- elsif fa_product_id == 'product_id' -%}
{%- capture fa_product_id_value -%}{{ fa_current_variant.id }}{%- endcapture -%}
{%- elsif fa_product_id == 'parent_id' -%}
{%- capture fa_product_id_value -%}{{product.id }}{%- endcapture -%}
{%- elsif fa_product_id == 'sku' -%}
{%- capture fa_product_id_value -%}{{ fa_current_variant.sku | escape }}{%- endcapture -%}
{%- endif -%}

{%- if cart.currency.iso_code == 'GBP' or cart.currency.iso_code == 'USD' or cart.currency.iso_code == 'JPY' or cart.currency.iso_code == 'AUD' or cart.currency.iso_code == 'AED' or cart.currency.iso_code == 'CAD' or cart.currency.iso_code == 'BWP' or cart.currency.iso_code == 'BND' or cart.currency.iso_code == 'DOP' or cart.currency.iso_code == 'GTQ' or cart.currency.iso_code == 'HKD' or cart.currency.iso_code == 'INR' or cart.currency.iso_code == 'ILS' or cart.currency.iso_code == 'YEN' or cart.currency.iso_code == 'KES' or cart.currency.iso_code == 'KOR' or cart.currency.iso_code == 'LBP' or cart.currency.iso_code == 'MYR' or cart.currency.iso_code == 'MXN' or cart.currency.iso_code == 'NPR' or cart.currency.iso_code == 'NZD' or cart.currency.iso_code == 'NIO' or cart.currency.iso_code == 'NGN' or cart.currency.iso_code == 'PKR' or cart.currency.iso_code == 'CNY' or cart.currency.iso_code == 'PHP' or cart.currency.iso_code == 'SGD' or cart.currency.iso_code == 'LKR' or cart.currency.iso_code == 'CHF' or cart.currency.iso_code == 'TWD' or cart.currency.iso_code == 'TSH' or cart.currency.iso_code == 'THB' or cart.currency.iso_code == 'UGX' or cart.currency.iso_code == 'KWD' or cart.currency.iso_code == 'CLP' or cart.currency.iso_code == 'BHD' -%}
{%- assign fa_product_price = fa_current_variant.price | money_without_currency | remove:',' -%}
{%- else -%}
{%- assign fa_product_price = fa_current_variant.price | money_without_currency | remove:'.' | replace: ',', '.' -%}
{%- endif -%}

<script type="application/ld+json" data-creator_name="FeedArmy">
{
  "@context": "http://schema.org/",
  "@type": "Product",
  "@id": {{ canonical_url | json }},
  "name": "{{ product.title | strip_html | escape }}",
  "url": "{{ shop.url }}{{ product.url }}",
  "sku": "{{fa_product_id_value}}",
  {%- if product.variants.first.barcode.size >= 12 and product.variants.first.barcode.size <= 14 -%}
  "gtin": {{ product.variants.first.barcode }},
  {%- endif -%}
  "productID": "{{ product.id }}",
  "brand": {
    "@type": "Brand",
    "name": "{{ product.vendor | escape }}"
  },
  "description": {{ product.description | strip_html | json }},
  "image": "https:{{ product.featured_image.src | img_url: '1500x1500' }}",
  {%- if product.variants -%}
    "offers":
      {
        "@type" : "Offer",
        {%- if fa_returns == 'true' -%}
        "hasMerchantReturnPolicy": {
          "@type": "MerchantReturnPolicy",
          "applicableCountry": "{{ fa_product_id_alpha2_code }}",
          "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow",
          "merchantReturnDays": {{ fa_return_days }},
          "returnMethod": "https://schema.org/ReturnByMail",
          "returnFees": "https://schema.org/FreeReturn"
        },
        {%- endif -%}
        {%- if fa_shipping == 'true' -%}
        "shippingDetails": {
          "@type": "OfferShippingDetails",
          {% if fa_shipping_price %}
          "shippingRate": {
              "@type": "MonetaryAmount",
              "value": {{ fa_shipping_price }},
              "currency": "{{ fa_shipping_currency }}"
          },
          "weight":{
              "@type": "QuantitativeValue",
              "value" : "{{ product.variants.first.weight | weight_with_unit }}"
          },
          {%- endif -%}
          "shippingDestination": {
            "@type": "DefinedRegion",
            "addressCountry": "{{ fa_product_id_alpha2_code }}"
          },
          "deliveryTime": {
            "@type": "ShippingDeliveryTime",
            "handlingTime": {
              "@type": "QuantitativeValue",
              "minValue": {{fa_shipping_handling_time_min}},
              "maxValue": {{fa_shipping_handling_time_max}},
              "unitCode": "DAY"
            },
            "transitTime": {
              "@type": "QuantitativeValue",
              "minValue": {{fa_shipping_shipping_time_min}},
              "maxValue": {{fa_shipping_shipping_time_max}},
              "unitCode": "DAY"
            }
          }
        },
        {%- endif -%}
        "priceCurrency": "{{ cart.currency.iso_code }}",
        "price": "{{ fa_product_price }}",
        "itemCondition" : "http://schema.org/NewCondition",
        "availability" : "http://schema.org/{% if fa_current_variant.available %}InStock{% else %}OutOfStock{% endif %}",
        "url" : "{{ shop.url }}{{ fa_current_variant.url }}",
            {%- if fa_current_variant.image -%}
              {%- assign variant_image_size = fa_current_variant.image.width | append: 'x' -%}
              "image": "https:{{ fa_current_variant.image.src | img_url: variant_image_size }}",
            {%- else -%}
              "image": "https:{{ product.featured_image.src | img_url: '1500x1500' }}",
            {%- endif -%}
            {%- if fa_current_variant.title != 'Default Title' -%}
              "name" : "{{ product.title | strip_html | escape }} - {{ fa_current_variant.title | escape }}",
            {%- else -%}
              "name" : "{{ product.title | strip_html | escape }}",
            {%- endif -%}
            {%- if fa_current_variant.barcode.size >= 12 and fa_current_variant.barcode.size <= 14 -%}
              "gtin": {{ product.variants.first.barcode }},
            {%- endif -%}
			        "sku": "{{fa_product_id_value}}",
            {%- if product.description != blank -%}
            "description" : {{ product.description | strip_html | json }},
            {%- endif -%}
          "priceValidUntil": "{{ 'now' | date: '%s' | plus: 31536000 | date: '%Y-%m-%d' | uri_encode | replace:'+','%20' }}"
      }
    {%- if product.variants.size > 1 -%},
      "additionalProperty": [{
        "@type": "PropertyValue",
        "propertyID": "item_group_id",
        "value": "{{ product.id }}"
      }]
      {%- endif -%}
    {%- if product.metafields.spr.reviews -%}
    {%- assign fa_rating = product.metafields.spr.reviews | split: '"reviewCount": "' | last | split: '"' | first | plus: 0 -%}
    {%- if fa_rating > 0 -%}
    ,"aggregateRating": {
     "@type": "AggregateRating",
     "ratingValue": {{ product.metafields.spr.reviews | split: '"ratingValue": "' | last | split: '"' | first | plus: 0 }},
     "ratingCount": {{ product.metafields.spr.reviews | split: '"reviewCount": "' | last | split: '"' | first | plus: 0 }}
    }
    {%- endif -%}
    {%- endif -%}
  {%- endif -%}
}
</script>
{%- endif -%}
<!-- Copyright FeedArmy 2023 Version 3.21 -->
Get in touch with Emmanuel: a Google Shopping Specialist, Google Ads Diamond Product Expert, and also a a Google Product Expert Education 2021 & Tailwind 2023 Award winner.
Need Google Merchant Center or Google Shopping support?.

ilanadavis
Shopify Expert
188 25 60

@Shawn512please be careful just copying code. JSON-LD (the format of the structured data) is not the same thing as JSON and the advice to add it to your product.json file is incorrect.  JSON is a file format to transmit data. JSON-LD is a method to link data using JSON. Your theme has JSON-LD structured data but it's typically in a liquid file.

If your goal is to simply remove the non-critical issues, you can add the structured data. Non-critical issues are just Google's way of asking you to include the data if you have it, if not that's ok. You are not penalized for missing this information in structured data.

Google recommends using Merchant Center for the policies instead of adding it in structured data (see attached). It will then be up to Google's algorithm if they want to include the returns or delivery details in Rich Results.

 Alternative approach to configuring shipping and return settings with Google .png

When the structured data connects with Merchant Center via the product identifiers, Google will automatically pull the shipping and returns information from Merchant Center to include in the Rich Results. Search Console however doesn't recognize this so you end up receiving emails saying it's missing because the two tools don't talk to each other.

 

JSON-LD for SEO customers already have the shipping and returns information coming from Merchant Center assuming you have:
1. entered the unique product identifiers (GTIN or MPN) and
2. you have the policies set up in Merchant Center.

 

If Shopify and the shipping apps provide this information, I'd be happy to include it in JSON-LD for SEO. For now, it's not available so we depend on the information coming from Merchant Center.

 

You can configure the delivery information in Merchant Center using this doc or see if you can automatically pull it from Shopify.
You can configure the returns information in Merchant Center using this doc.

Ilana Davis, Shopify Superhero
JSON-LD for SEO, adds structured data to your theme, getting you more organic traffic with Rich Results.
Linking Llama, link complementary, comparable, or related products to improve SEO & UX.

EmmanuelFlossie
Shopify Partner
2979 222 716

You are not required to add structured data, if you have added the shipping and returns policy in Google Merchant Center.

Get in touch with Emmanuel: a Google Shopping Specialist, Google Ads Diamond Product Expert, and also a a Google Product Expert Education 2021 & Tailwind 2023 Award winner.
Need Google Merchant Center or Google Shopping support?.