Recurring weekly schedule for multiple sticky bars?

I’d love to swap between 2 different sticky bar messages, one for weekdays and one for weekends WITHOUT having to manually reset the scheduling dates every week. Does anyone know if there a way to do this?

Hi Melissa!

As far as I know, the only scheduling we can do with stickybars is to input a start date and end date. This would be great feedback for our feature request form if you have a moment.

Curious to see if other community members have found a workaround for this? I’ll keep my eyes peeled :banana:

Take care,

-Jess

1 Like

Hey @Melissa, custom script coming at you!

If you could select your special offer text and give it a class of “dynamic-offer”:

image

… then add this javascript (“before body end tag”)…

<script type="text/javascript">

// Identify the span within your "dynamic-offer" class
const dynamicOfferText = document.querySelectorAll(".dynamic-offer span")[0];

// Get the day of the week
const dayOfWeek = new Date().getDay();


// If the day of week is bigger than 5 (i.e. is 6 or 7), set it to weekend offer
if(dayOfWeek > 5) {
dynamicOfferText.innerText = "My very special WEEKEND offer";
} else {
dynamicOfferText.innerText = "My very special WEEKDAY offer";
}

</script>

… that’ll dynamically replace the text based on the day of week!

1 Like