To Add Delivery Date Option in PDP Dawn Theme

Solved

To Add Delivery Date Option in PDP Dawn Theme

Az94
Tourist
6 0 3

Hi,

 

I need help where I want to create a section where customer can choose their delivery date in the PDP. Currently, I am using Dawn theme. This feature should 

 

1. grey out from the past date

2. I should be able to disable certain date for delivery option.

3. the information - delivery date, should be included in my order detail page. 

 

As-is

Az94_0-1725596681074.png

 

To - be

Az94_1-1725596694762.png

 

Accepted Solutions (2)

prakashVt
Shopify Partner
267 23 36

This is an accepted solution.

Hello @Az94 

If you know a little bit of coding then insert this code on your PDP

<div>
  <label for="datePicker">Pick a Delivery Date:</label><br/>
    <input type="date" id="datePicker" name="properties['Delivery Date']" min="" />
</div>
    <script>
        // Set today's date as the minimum
        const today = new Date();
        const dateInput = document.getElementById('datePicker');
        dateInput.min = today.toISOString().split('T')[0];

        // Disable weekends (Saturday and Sunday)
        dateInput.addEventListener('input', function() {
            const selectedDate = new Date(this.value);
            const day = selectedDate.getUTCDay(); // 0: Sunday, 6: Saturday

            if (day === 0 || day === 6) {
                alert('Weekends are not allowed. Please choose a weekday.');
                this.value = ''; // Clear the invalid selection
            }
        });
    </script>
- Enhanced your Cart Drawer for free, Shipping Protection included -VTN Cart Drawer Pro
- Feel free to Contact for more help (Free Support): prakash.prabhakar@vtnetzwelt.com

View solution in original post

Sajat
Shopify Partner
311 35 47

This is an accepted solution.

Hi @Az94 ,

Welcome to Shopify Community.

 

This is achievable with pretty simple code.

Go to Online Store -> Edit code

Search for the file buy-buttons.liquid.

Search for the code  <div class="product-form__buttons">

 

Just above this code, paste this code

 

<label for="delivery-date" class="form-label">Delivery date</label>
<input type="date" id="delivery-date" name="properties[delivery-date]">
<div>We deliver from Monday to Friday. For weekend deliveries, please call.</div>

 

 

and thats all, you will get the delivery date field on the product page and the delivery date entered by the visitor are displayed on details of order.

You can add your own styles from your main css file under assets.

 

Thank you,

Sajat

-------------------------------------------------------------------------------------------
If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.

 

 

View solution in original post

Replies 2 (2)

prakashVt
Shopify Partner
267 23 36

This is an accepted solution.

Hello @Az94 

If you know a little bit of coding then insert this code on your PDP

<div>
  <label for="datePicker">Pick a Delivery Date:</label><br/>
    <input type="date" id="datePicker" name="properties['Delivery Date']" min="" />
</div>
    <script>
        // Set today's date as the minimum
        const today = new Date();
        const dateInput = document.getElementById('datePicker');
        dateInput.min = today.toISOString().split('T')[0];

        // Disable weekends (Saturday and Sunday)
        dateInput.addEventListener('input', function() {
            const selectedDate = new Date(this.value);
            const day = selectedDate.getUTCDay(); // 0: Sunday, 6: Saturday

            if (day === 0 || day === 6) {
                alert('Weekends are not allowed. Please choose a weekday.');
                this.value = ''; // Clear the invalid selection
            }
        });
    </script>
- Enhanced your Cart Drawer for free, Shipping Protection included -VTN Cart Drawer Pro
- Feel free to Contact for more help (Free Support): prakash.prabhakar@vtnetzwelt.com

Sajat
Shopify Partner
311 35 47

This is an accepted solution.

Hi @Az94 ,

Welcome to Shopify Community.

 

This is achievable with pretty simple code.

Go to Online Store -> Edit code

Search for the file buy-buttons.liquid.

Search for the code  <div class="product-form__buttons">

 

Just above this code, paste this code

 

<label for="delivery-date" class="form-label">Delivery date</label>
<input type="date" id="delivery-date" name="properties[delivery-date]">
<div>We deliver from Monday to Friday. For weekend deliveries, please call.</div>

 

 

and thats all, you will get the delivery date field on the product page and the delivery date entered by the visitor are displayed on details of order.

You can add your own styles from your main css file under assets.

 

Thank you,

Sajat

-------------------------------------------------------------------------------------------
If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.