{"id":11931207,"date":"2019-09-14T03:21:17","date_gmt":"2019-09-14T03:21:17","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/plugin-does-not-add-availability-field\/"},"modified":"2019-09-14T03:21:17","modified_gmt":"2019-09-14T03:21:17","slug":"plugin-does-not-add-availability-field","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/plugin-does-not-add-availability-field\/","title":{"rendered":"Plugin does not add &#8220;availability&#8221; field"},"content":{"rendered":"<p>Hello<br \/>\nLet me begin my congratulating you on creating this very valuable plugin. I have been using it for a while now and it works just as promised.<\/p>\n<p>However, after reviewing my Google Search Console (GSC), I noticed the following errors for every product :<br \/>\nMissing field &#8216;availability&#8217;<\/p>\n<p>After digging deeper, I discovered that the &#8220;availability&#8221; field is being excluded by Lines 1197-1219 of file woocommerce-sea.php<\/p>\n<pre><code>                                if ( $lowest === $highest ) {\n\n                                        $markup_offer = array(\n                                                &#039;@type&#039; =&gt; &#039;Offer&#039;,\n                                                &#039;price&#039; =&gt; wc_format_decimal( $lowest, wc_get_price_decimals() ),\n\t\t\t\t               \t&#039;priceValidUntil&#039;    =&gt; $price_valid_until,\n\t\t\t\t\t        &#039;priceCurrency&#039; =&gt; $shop_currency,\n                                        );\n\n                                } <\/code><\/pre>\n<p>It seems like that is the only clause that is missing the &#8220;availability&#8221; field. <\/p>\n<p>If I disable the &#8220;woocommerce_structured_data_product_offer&#8221; filter by commenting out Line 1251 of the woocommerce-sea.php, all is well. i.e. Availability is added to the schema.<\/p>\n<p>I just wanted to bring this bug to your attention. Hope you can fix it in the next iteration.<\/p>\n","protected":false},"template":"","class_list":["post-11931207","topic","type-topic","status-publish","hentry","topic-tag-errors","topic-tag-gsc"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11931207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11931207\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=11931207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}