<meta itemprop="availability" content="in_stock" />

Solved
Highlighted
Excursionist
42 1 2

Hi 

I tested our site with google strucktured data test tool https://search.google.com/structured-data/testing-tool. And it said that we have an error in our strucktured date code regarding availability.

How do i fix this?
Can i change this code in product.description-buttom.liquid from:

<meta itemprop="availability" content="{% if product.available %}in_stock{% else %}out_of_stock{% endif %}" />

 

To:

<meta itemprop="availability" content="{% if product.available %}<link itemprop="availability" href="http://schema.org/InStock" />{% else %}<link itemprop="availability" href="http://schema.org/OutOfStock" />{% endif %} ?

 

1 Like
Highlighted
Excursionist
42 1 2

This is an accepted solution.

Fixed it with this line of code

<link itemprop="availability" href="http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}">

 

1 Like