Hello @pramodraam ,
To restrict the checkout button on a Shopify store cart page until a radio button is selected, you’ll need to modify the theme code.
Here are the steps you can follow to achieve the same
Log in to your Shopify admin dashboard.
Go to Online Store > Themes > Actions > Edit Code.
(Note: The specific code and file locations may vary slightly depending on your theme.)
Now, locate the file that controls the cart page in the theme code editor. This file is usually named “cart.liquid” or “cart-template.liquid.” Look for it in the “Sections” or “Templates” folder.
Search the cart template file for the section of code that renders the radio button options.
This code may vary depending on the theme and how the radio buttons are implemented.
Look for an HTML markup that represents the radio button group.
Once you’ve located the radio button group, add an event listener using JavaScript/jQuery. This listener will monitor changes to the radio button selection.
If you’re using jQuery, you can use the change event to detect when the radio button selection changes.
If you prefer plain JavaScript, use the addEventListener method with the change event.
Check whether the desired radio button option is selected inside the event listener. If it is, enable the checkout button; otherwise, disable it.
To disable the checkout button, you can add the disabled attribute to the button element.
To enable the checkout button, you can remove the disabled attribute.
Code for the radio button :
Paste the below code in the form on the cart page
Option 1
Option 2
Source Code:
Save the changes you made to the theme code.
After following these steps, the checkout button on the cart page will be disabled by default. It will only become enabled when the desired radio button option is selected.
Also, If you are not experienced with Shopify code or theme, we advise contacting a Shopify expert to help you fix this.
Hope it works. Feel free to connect with us if you need more help with Shopify.
All the best,
CedCommerce