Personalized checkout and custom promotions with Shopify Scripts
Hello,
I want to display radio boxes and dropdowns for selecting a variant on desktop and only dropdowns on mobile.
At the moment it displays the desktop variant on both. And I would have to differ within the liquid code which creates the dropdowns/radio boxes between the screen size. So that it can create the right elements.
But as liquid can not differ between it. I need a workaround for it.
I can also not put a <script> around it and differ with js, because the liquid code in it does not work anymore.
Does someone know a workaround for that?
Thank you!
Solved! Go to the solution
This is an accepted solution.
Hello,
I was able to fix this issue.
I made extra code with creates checkboxes as well as the dropdowns.
But the checkboxes don't have any classes, where JS would be behind.
After that I made a custom script, which changes the value of the checkboxes when the dropdown changes and changes the value of the dropdown when the checkbox changes. Then I did not display the checkboxes for mobile and the dropdowns not for desktop.
Problem solved.
This is an accepted solution.
Hello,
I was able to fix this issue.
I made extra code with creates checkboxes as well as the dropdowns.
But the checkboxes don't have any classes, where JS would be behind.
After that I made a custom script, which changes the value of the checkboxes when the dropdown changes and changes the value of the dropdown when the checkbox changes. Then I did not display the checkboxes for mobile and the dropdowns not for desktop.
Problem solved.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025