Jump to content

Hide section inside a page based on a date/time

Recommended Posts

Site URL: https://www.heyuhuman.com/the-foundation

Hello community! 

For a limited time, we are doing a promotion/bonus for people who purchase before a specified date. I know there is coding to show a countdown timer on the page but is it possible to have the section hidden after the time expiry. Having a countdown showing BONUS EXPIRED is a purchasing deterrent so I'd rather the section just be hidden so it's just purchasing as normal. 

 

Thank you so much for your expertise! 

Link to comment

Yes it should be possible with some Javascript which would require the business plan or above.

Since this would be done client-side, in the browser, there is a caveat. The code could be gotten around or might fail in certain circumstances. If you can live with those limitations, let us know and we might be able to come up with some code.

The manual way to do this would be to have someone make changes in the site at the appropriate time. So if someone stayed up till midnight then they could make the changes and there would be no need for code that could fail in some circumstances.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to comment
  • 1 year later...

@creedon I've been following your solutions and would like to thank you for all of your work. I will also donate on your github accordingly.

Hoping you can help me - I tried utilizing this solution in conjunction with your code from Jul 26 in Looking to remove or disable the add to cart button on the product page . I'm having trouble modifying the selector in this code to work with #item. Can you please offer a suggestion when you get a chance?

 

In short, for a specific product page, I have the 'Add to Cart' button hidden initially. I then want the script to execute and display the button if it's after a specific date and time.

https://calliope-burgundy-25l9.squarespace.com/tix/p/country-feast-set-3nybt-64ce4-w46gd

Thank you.

Link to comment
On 2/18/2023 at 9:30 AM, oyolab said:

Hoping you can help me - I tried utilizing this solution in conjunction with your code from Jul 26 in Looking to remove or disable the add to cart button on the product page.

Although elements of the codes you mention may be helpful, the effect you want is coming from the other direction. You want to hide the atc button until a certain date/time. I think fresh code would be a better direction.

Do you want this effect for just one product or will you want to apply it to multiple products?

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to comment
On 2/20/2023 at 6:24 AM, oyolab said:

I would like the ability to put this into effect for specific products please.

That should be doable. Give me several days to see what I can come up with.

Another question. Are the users of the site only going to be local or do you expect folks from other time zones to want to buy products? I ask because working with time zones is a nightmare on computers. It hurts my brain! 🙂

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to comment
On 2/18/2023 at 9:30 AM, oyolab said:

In short, for a specific product page, I have the 'Add to Cart' button hidden initially. I then want the script to execute and display the button if it's after a specific date and time.

Please see Store Product Detail Add To Cart Show After Date Time.

Note this code takes care of hiding the atc buttons for you. This code hides all atc buttons and then decides to show or not.

Remove any existing atc button hiding code you have.

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.