Change date field so customer must choose one

Highlighted
Tourist
6 0 0

Hi all,

I need to change a field on my productss pages.

https://lunchwithcrunch.co.nz/products/mini-gingerbread-person?variant=35733774401692

Where it says to select delivery date it defaults to the first availible date, I need this to default to "Select Delivery Date", and then force the customer to choose one.

This field also needs to be Mandatory

Any ideas?

0 Likes
Highlighted
Excursionist
46 11 13

Hello, @lunchwithcrunch 

Hope you are doing great on these crazy times!

You can do this, but you would need to know a little bit of JS and Liquid to do it. The first that you need to do is create a script that a field and make the validations for the fields so it would prevent weird behaviors. 

Feel free to reach me out, i would gladly work with you! Email me juansmartdev@beeethereal.com

Kindly Regards, 

Juan

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Worked for 2 years as Shopify Developer.
◦ Contact me at: juansmartdev@beeethereal.com
1 Like
Highlighted
Tourist
4 0 1

I've done something similar, though on our store we are collecting the delivery time for the whole order on the cart page rather than per-product as you seem to be doing. 

Things I needed to do:

1) Find the start of the existing form in the theme's section file and remove the 'novalidate' attribute:

 

    {%- comment -%} Customisation: removed "novalidate" from the form to force entry of the pickup time {%- endcomment -%}
    <form action="{{ routes.cart_url }}" method="post"  class="cart">

 

2) Make the default entry in the selection list completely blank so it fails validation until the user selects something.  Note that I put the whole <select> into a snippet file included into the original theme with {% render %}.

3) Make the other <option> lines  list have the 'selected' attribute if they matched the existing value of the cart attribute I use to hold the value.  This will be a bit different for you with per-product attributes rather than cart attributes.

 

1 Like