Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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 @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
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024