Imagine buying some flowers to be delivered tomorrow. You select the perfect azaleas, pick out a container, a teddy bear and then you choose the delivery date. With a big smile you press the checkout button, fill out your credit card details and pay. Everything looks good, the payment went through. Now to check the confirmation email. You glance over it..and then you see the mistake. The wrong date. You selected the right day, the right year but picked the previous month! Staring at the ceiling, hands clasping the sides of your face you wonder how many calls you'll make to get it fixed. Will the flowers even get there tomorrow?
Don't let this happen to your customers. If you are in the business of delivering products then you have to smarten up the delivery date feature to prevent erroneous dates from being selected. The code below will show you how to do just that:
Login to your control panel and navigate to Design -> Theme Files/Edit HTML & CSS and open the product.html file.
- Add the following code to the bottom of the file, right before the </body> tag:
Save your changes.
How It Works
The code works on multiple fronts to prevent erroneous date selections. First, it sets the delivery date to the current date. It then removes the blank date options from the the drop downs. After all, why would you let a customer select a blank day or month? After that, it makes sure that you can only select current or future dates. If the current month is August, then you will not be able to select July from the drop down. Likewise, if the current is 2014 then you will not be able to select 2013 from the drop down.
If the date values are wrong... then make sure your computer's date settings are updated and correct. The script makes use of your local time for the current date, so the default values will be updated accordingly for each individual customer.
If the current date is not set... then you are probably using a product option with a date value. Remove the option from the product, and use the delivery date feature and the script will work.
If it still doesn't work or you want to do something different...then contact us. We can install the modification for you.