Shopify themes, liquid, logos, and UX
Hey guys, have tried to edit theme to hide colour variants with single option as per other posts but cant get it to work. We have colour option with only 1 option - black on all our products. Would like to hide variants with only one option. We need to keep the variant there for our print on demand, but yeh want it hidden on front end. Any help would be appreciated!
website is --> www.electricwitch.com.au
Solved! Go to the solution
This is an accepted solution.
Hey @ElectricWitch
Follow these Steps:
1) Go to Online Store
2) Edit Code
3) Find theme.liquid file
4) Add the following code in the bottom of the file above </body> tag
<style>
fieldset.variant-picker__option.no-js\:hidden:nth-child(1) {
display: none !important;
}
</style>
RESULT:
If I managed to help you then, don't forget to Like it and Mark it as Solution!
Best Regards,
Moeed
This is an accepted solution.
Hey @ElectricWitch
Keep the previous code and add this new code above </style> in the end of the theme.liquid file.
.variant-picker .h-stack.gap-2 {
display: none !important;
}
RESULT:
If I managed to help you then, don't forget to Like it and Mark it as Solution!
Best Regards,
Moeed
This is an accepted solution.
Hey @ElectricWitch
Follow these Steps:
1) Go to Online Store
2) Edit Code
3) Find theme.liquid file
4) Add the following code in the bottom of the file above </body> tag
<style>
fieldset.variant-picker__option.no-js\:hidden:nth-child(1) {
display: none !important;
}
</style>
RESULT:
If I managed to help you then, don't forget to Like it and Mark it as Solution!
Best Regards,
Moeed
Legend mate, that was so quick, worked perfect. thankyou!
would u know how to hide the size read out also? for example 'Size:XL'
This is an accepted solution.
Hey @ElectricWitch
Keep the previous code and add this new code above </style> in the end of the theme.liquid file.
.variant-picker .h-stack.gap-2 {
display: none !important;
}
RESULT:
If I managed to help you then, don't forget to Like it and Mark it as Solution!
Best Regards,
Moeed
perfect mate appreciate your help!
Thank you for your reply. I'm glad to hear that the solution worked well for you. If you require any more help, please don't hesitate to reach out. If you find this information useful, a Like would be greatly appreciated.
Hey mate, turns out this wont work on some items that dont have a colour option....it goes ahead and hides all the sizes because they are variant #1 on these products. i need to filter out any variant with only one option. . I believe i need to edit the variant-picker.liquid to do this. would you be able to help with that at all?
Hey @ElectricWitch
I see, it's causing some issues. Can you share your collaborator request code in private messages so I can help you out properly?
Best Regards,
Moeed
Hi @ElectricWitch ,
1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.liquid file
3. In theme.liquid, paste the below code before </head>
<style>
fieldset.variant-picker__option.no-js\:hidden:nth-child(1) {
display: none !important;
}
</style>
If my reply is helpful, kindly click like and mark it as an accepted solution.
Thanks!
Thanks, but this always hides the first variant. I need to hide variants with only 1 option, regardless of the position. How would I do this?
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024