Solved

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?

icon

Best answer by Harvey_Carpenter 10 June 2020, 15:54

View original

2 replies

Userlevel 7
Badge +1

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 🍌

Take care,

-Jess

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!

Reply