Delivery Date picker

Hello,

Im trying to implement the default delivery date picker snippet.

https://help.shopify.com/en/manual/online-store/themes/customizing-themes/add-date-picker

But I would like to adjust it by excluding some days based on the day and hour of the order /

  • If current time is later then 1pm from Monday to Friday , exclude next day

  • If it is Saturday before 1 pm , exclude next day

  • If it is Saturday after 1 pm , exclude next 2 days

  • if it is Sunday , exclude next day

  • Exclude all Sundays.

All help or tips are appreciated , Thanks

I have this code now but it is failing :

{{ ‘//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css’ | stylesheet_tag }}

Kies je leverdatum: We leveren niet op zondag.

Thanks for your help.

I tried the code but still have the same issue .

It is sunday 11h14 pm now and I get this :

Delivery on Monday the 9th should not be possible.

Hi @BIAB ,

You’re really close — and it’s great you’re working through this with the native Shopify date picker snippet.

To get your logic working reliably, you’ll want to make sure:

  • The minDate setting is dynamically set before the calendar renders.

  • The beforeShowDay function continues to block Sundays.

Here’s a version that should more accurately reflect your intent:

$(function() { const now = new Date(); const day = now.getDay(); const hour = now.getHours(); let bufferDays = 0; // Determine buffer based on logic if (day === 0) { bufferDays = 1; // Sunday → block next day (Monday) } else if (day === 6 && hour < 13) { bufferDays = 1; // Saturday before 1pm → block next day } else if (day === 6 && hour >= 13) { bufferDays = 2; // Saturday after 1pm → block next 2 days } else if (hour >= 13) { bufferDays = 1; // Mon–Fri after 1pm → block next day } $(“#datepicker”).datepicker({ minDate: bufferDays, beforeShowDay: function(date) { return [date.getDay() !== 0]; // disable Sundays } }); });

You should also make sure the #datepicker input exists on the page when this script runs — or wrap it in a check with something like if ($(‘#datepicker’).length).

If you ever want a more scalable approach (e.g. if dates vary by product or shipping method), Flare is one app that can handle these rules automatically without needing custom jQuery — but your current path is perfect if you’re just customizing a basic theme.

Let me know if you need help debugging further — happy to assist!