Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search

Custom Javascript for item variants (Timezone)


Recommended Posts

Site URL: https://www.mandarintree.nl/store-1

Hi,

I'm selling online lessons to customers around the world. I'm currently listing variants in UTC time, but this has caused confusion with some customers.

I would like the time slot (the variant category) to display the client side timezone (see https://www.mandarintree.nl/store-1/p/g8unmo5nrqqe2bg7uc6nau94y6pkvg-w97bk) instead of UTC

I know some basic javascript - and I'm aware how to add that inside a code block in squarespace to get the client timezone:

e.g., 

<script type="text/javascript">
 var timezone = encodeURIComponent(jstz.determine().name()); 

</script>

What I'm not sure how to do (or if it's possible) is to modify the string of the variant name to update the time (i.e., edit variant-select-wrapper).

Is this possible, are there any similar examples I could work from?

Link to post
  • 1 month later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Posts

Site URL: https://www.mandarintree.nl/store-1 Hi, I'm selling online lessons to customers around the world. I'm currently listing variants in UTC time, but this has caused confusion with some c

On 2/4/2021 at 6:39 AM, KarenKT said:

Site URL: https://www.mandarintree.nl/store-1

Hi,

I'm selling online lessons to customers around the world. I'm currently listing variants in UTC time, but this has caused confusion with some customers.

I would like the time slot (the variant category) to display the client side timezone (see https://www.mandarintree.nl/store-1/p/g8unmo5nrqqe2bg7uc6nau94y6pkvg-w97bk) instead of UTC

I know some basic javascript - and I'm aware how to add that inside a code block in squarespace to get the client timezone:

e.g., 

<script type="text/javascript">
 var timezone = encodeURIComponent(jstz.determine().name()); 

</script>

What I'm not sure how to do (or if it's possible) is to modify the string of the variant name to update the time (i.e., edit variant-select-wrapper).

Is this possible, are there any similar examples I could work from?

What is the variable jstz you are using?

We can convert the time across time zone using library like moment js

Greeting, it's BaNgan from BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement, Enable Pinch/Zoom on lightbox, 360 degree photo blockSortable Table from GSheet
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to post

Create an account or sign in to comment

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


×
×
  • Create New...