Google Console - need to add priceValidUntil to theme.liquid today's date plus 30 days

Google Console - need to add priceValidUntil to theme.liquid today's date plus 30 days

Nina_Christense
New Member
7 0 0

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!

Reply 1 (1)

PaulNewton
Shopify Partner
7450 656 1561

Hi @Nina_Christense 👋 , 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" }}"
}

 

 

Contact [email protected] for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org