Announcement

Collapse
No announcement yet.

Can I specify a delivery cut-off time for orders?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Can I specify a delivery cut-off time for orders?

    This article will show you how you could add a warning to your site that tells people whether their order will be sent the same day.

    Simply place the following code into your product layout where you want the message to appear:

    <script language=JavaScript>
    now = new Date();
    if ( now.getUTCHours() >= 16 ) document.write('<span style="color:red;">Warning text here</span>');
    </script>

    In the above example, the cut-off time is 4pm - 16.00. If you want a different time, change the '16' to another number on the 24 hour clock.

    You can also put this code into the overall page layout for the store.

    You can expand on this further, by having different messages according to the day of the week as follows:-

    <script language=JavaScript>
    now = new Date();
    if ( now.getUTCHours() >= 16 )
    if ( now.getUTCDay() == 1)
    document.write('<span style="color:red;">Monday warning text here</span>');
    </script>

    <script language=JavaScript>
    now = new Date();
    if ( now.getUTCHours() >= 16 )
    if ( now.getUTCDay() == 2)
    document.write('<span style="color:red;">Tuesday warning text here</span>');
    </script>

    Add more of the above in for each day where the UTCDay will be:

    0 for Sunday
    1 for Monday
    2 for Tuesday
    3 for Wednesday
    4 for Thursday
    5 for Friday
    6 for Saturday

    Alternatively, you could have a generic script that encompasses Monday to Saturday by using the following:

    <script language=JavaScript>
    now = new Date();
    if ( now.getUTCHours() >= 16 )
    if ( now.getUTCDay() > 0)
    if ( now.getUTCDay() < 6)
    document.write('<span style="color:red;">Monday to Friday warning text here</span>');
    </script>

    This last one assumes that there is no delivery service on Sundays regardless of time, hence the absence of the time element:

    <script language=JavaScript>
    now = new Date();
    if ( now.getUTCDay() == 0)
    document.write('<span style="color:red;">Sundaywarning text here</span>');
    </script>


    You can have as many of these as you want, and only those which meet the day and time criteria will be shown.

    This could even be used for marketing messages, so you could create a special offer which is only available on Fridays until 2pm for example.

    The Universal Coordinated Time (UTC) is the time set by the World Time Standard, and is equivalent to GMT. However, you would have to adjust the cut-off time during the summer months, when GMT is advanced an hour, so the above example would work ok in winter for a 4pm cut-off, but 16 would need to be changed to 15 during summer time.


    Disclaimer: This code was provided by an SellerDeck user via the SellerDeck Community (http://community.sellerdeck.com/) and so can't be supported by the SellerDeck Technical Support team.
Working...
X