If product is in stock, show shipping date, if product is pre-order do not show.

New Member
2 0 0

I  have a code needs to show the shipping terms phrase if product is in stock only. As there are some products on pre-order in our shop. But it won't work. Can anyone help? Thanks!

{% unless product.description contains "BUY NOW TO PRE-ORDER!" %}

<p> <img src="https://cdn.shopify.com/s/files/1/0043/0886/1046/files/download.png?v=1626058955” style="height:25px;float:left;margin-right:10px;padding-bottom: 4px;">
Ships 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 }}

var fromDate = Date.today().addDays(1);
if (fromDate.is().saturday() || fromDate.is().sunday()) {
fromDate = fromDate.next().monday();
var toDate = Date.today().addDays(3);
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');

{% endunless %}