Liquid, JavaScript, themes, sales channels
Hi,
I'm using the new Sense Theme and I'm trying to show the text"Free Shipping until (current date/today's date)"using metafields, but I can't find a way to do that. I already tried to use the metafield date and I've been searching for a solution, but with no sucess.
Does anyone know how can I add that Current Date Metafield text?
Solved!Go to the solution
This is an accepted solution.
You can display the current date with a Liquid snippet like this:
Free Shipping until {{'now' | date: "%Y-%m-%d" }}
Also, you may want to visit the following resources to learn more about the dates in Liquid:
And the metafield-based date can be displayed like this:
Free Shipping until {{ product.metafields.my_fields.date.value }}
Hi André,
Could you please share more details on this task? What date would you like to display in that "Free Shipping" message? The "today" date (and make sure that it would be updated automatically), a static date from a metafield etc.
This is an accepted solution.
You can display the current date with a Liquid snippet like this:
Free Shipping until {{'now' | date: "%Y-%m-%d" }}
Also, you may want to visit the following resources to learn more about the dates in Liquid:
And the metafield-based date can be displayed like this:
Free Shipping until {{ product.metafields.my_fields.date.value }}
It worked! It's exactly what I wanted to do. I used your first code example.
Thank you very much!
I am using the date metafield. By default it displayed date as YYYY-MM-DD. I added this code: "|日期:“% m - % d % Y”,现在显示为:mM-DD-YYYY.
As a business owner, have you ever wondered when your customer's first impression of yo...
BySkye Jun 6, 2023We're excited to announce improvements to the threaded messaging experience in our communi...
ByTyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
ByJacqui May 30, 2023