Google console is saying that my product pages are missing priceValidUntil.
I found code here but can’t seem to get the write formatting: https://www.huratips.com/tech-tips/how-to-add-days-to-date-in-shopify-liquid.html
{% assign seconds = 5 | times: 24 | times: 60 | times: 60 %}
{{ ‘now’ | date: “%s” | plus: seconds | date: “%Y-%m-%d” }}
How can I add it here to offers?
“offers”: {
“@type”: “Offer”,
“price”: {{ product.selected_or_first_available_variant.price | money_without_currency | remove: “,” }},
“priceCurrency”: “{{ shop.currency }}”,
“availability”: “{%- if product.selected_or_first_available_variant.available -%}InStock{%- else -%}OutOfStock{%- endif -%}”,
“itemCondition”: “http://schema.org/NewCondition”
}
Some technical help is most appreciated!
Hi @Antonina1
, warnings are not errors and such warnings are easily researchable for validity.
Unless offerings actually expire you can probably ignore this warning because it’s only a “warning” it’s not an error.
Shopify servers CACHE pages, so generating “dates” may not continuously update leading to out of date content.
So a month from now schemas could just shows expired dates.
Do your homework on shopify cache you have been warned.
{% assign seconds = 30 | times: 24 | times: 60 | times: 60 %}
Once liquid logic is working it could be uses for priceValidUntil like this:
"offers": {
"@type": "Offer",
"price": {{ product.selected_or_first_available_variant.price | money_without_currency | remove: "," }},
"priceCurrency": "{{ shop.currency }}",
"availability": "{%- if product.selected_or_first_available_variant.available -%}InStock{%- else -%}OutOfStock{%- endif -%}",
"itemCondition": "http://schema.org/NewCondition",
"priceValidUntil": "{{ 'now' | date: "%s" | plus: seconds | date: "%Y-%m-%d" }}"
}