Customers can select a delivery time in the past of the current day
-
In Chrome if the current time is 2:00 pm, you cannot select 1:00 pm as a delivery time, which is expected behavior. But in Safari, DuckDuckGo, and probably other browsers, you can still select the time.
This is a bug/unsupported feature of those browsers not supporting “style=’display:none;'” being added to the ‘option’ tag. Those browsers require the ‘disabled’ attribute to be added.
Below is a patch for adding the ‘disabled’ attribute in addition to using the ‘display’ style.
Index: trunk/public/js/dtwc-public.js =================================================================== --- trunk/public/js/dtwc-public.js (revision 2515956) +++ trunk/public/js/dtwc-public.js (working copy) @@ -99,9 +99,11 @@ if (item<=dtwc_settings.prepTime) { // Remove specific time from available options. $("#dtwc_delivery_time option[value='" + item + "']").hide(); + $("#dtwc_delivery_time option[value='" + item + "']").prop('disabled', true); } else { // Add specific times to available options. $("#dtwc_delivery_time option[value='" + item + "']").show(); + $("#dtwc_delivery_time option[value='" + item + "']").prop('disabled', false); } } @@ -108,6 +110,7 @@ // Delivery times reset. function resetTimes(item) { $("#dtwc_delivery_time option[value='" + item + "']").show(); + $("#dtwc_delivery_time option[value='" + item + "']").prop('disabled', false); } });
- The topic ‘Customers can select a delivery time in the past of the current day’ is closed to new replies.