Change script depending, if the product is in stock and or not in stock

New Member
2 0 0

Hi guys,

I have a script for showing when product will be dispatched:

{{ '//' | script_tag }}

var fromDate =;
if ( || {
fromDate =;
var toDate =;
if ( ||
toDate =;

document.getElementById('fromDate').innerHTML = fromDate.toString('dddd MMMM dS');
document.getElementById('toDate').innerHTML = toDate.toString('dddd MMMM dS');

It needs to be only shown, if product.description does not contain :

"BUY NOW TO PRE-ORDER!" words. As we have some products in stock and pre-order.

Can anyone help how to change this script properly?