Validating Required Field when clicking "Buy It Now" dynamic button

Highlighted
New Member
1 0 0

Hello, 

On all of our product pages, we have a Delivery Date picker that is required. I was able to adjust to code to make that work when people select the "add to cart" button. However, when they select the "Buy it Now" button it will take them to checkout even if the delivery date field is blank. I have read that there is some additional code needed to do this. Can anyone help me with this?

 

Thanks!

0 Likes
Highlighted
Shopify Partner
1152 232 299

Hello @frontporchgift ,

1) On initial view make 'Buy now' button hidden. Now create a JS function which will detect change in date input field as any change happened change 'buy now' to display block.

2) Once page loaded add disabled attribute to 'buy now' button and as there is change happened in date picker field remove attribute disabled.

Hope these steps will give you idea to write code.

Thanks

Want to modify or custom changes on store hire me.
My Email: guleriathakur43@gmail.com
Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate small Click here (Its my paypal)
0 Likes