Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hey guys, I’m trying to use a liquid script to show estimated delivery dates on my product pages. So far I have been using the script below from this article I found (my site is gofirepits.com, built on Venture theme):
<p> <img src="https://cdn-icons-png.flaticon.com/512/1670/1670915.png" style="height:25px;float:left;margin-right:10px;padding-bottom: 4px;"/>
Get it between <strong><span id="fromDate"></span> - <span id="toDate"></span></strong></p>
{{ '//cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js' | script_tag }}
<script>
var fromDate = Date.today().addDays(5);
if (fromDate.is().saturday() || fromDate.is().sunday()) {
fromDate = fromDate.next().monday();
}
var toDate = Date.today().addDays(10);
if (toDate.is().saturday() || toDate.is().sunday()) {
toDate = toDate.next().monday();
}
document.getElementById('fromDate').innerHTML = fromDate.toString('dddd MMMM dS');
document.getElementById('toDate').innerHTML = toDate.toString('dddd MMMM dS');
</script>
I’ve pasted it exactly as described on line 159 of product-template.liquid. The problem I am having with this script is that it only shows estimated delivery dates in terms of calendar days after the date of viewing. This is a problem because my shipping times are in business days, not calendar days. It looks like there’s a conditional script for both “fromDate” and “toDate” that is supposed to account for business days, but in my experience implementing it on my site that has not worked.
Hi @rad_rod,
If so, instead of you showing 5 and 10, you can change the number to your liking.
So instead of 5 days after the business day, you can change it to 4 as your requirement.
Hope it helps!
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025