Hello,
How do I change the variant “type value” and variant “size value” in “background black color” and the “text white color” when selected?
Your help is appreciated.
Store: www.visualwallart.com
A store owner wants to change the background color to black and text color to white for selected product variant options (type and size values).
Initial Solutions Attempted:
</head> tag in theme.liquid fileResolution:
The second approach initially worked only for variant type values, not size values. The final working solution required adding !important flags to the CSS:
.single-option-radio input[type=radio]:checked+label {
background-color: #000 !important;
color: #fff !important;
}
This code, placed in <style> tags within theme.liquid, successfully applies the styling to both variant types and sizes. The issue is now resolved.
Hello,
How do I change the variant “type value” and variant “size value” in “background black color” and the “text white color” when selected?
Your help is appreciated.
Store: www.visualwallart.com
Hi, @vwa-decor
Can you please share the store URL so that I can assist you?
Follow these steps:
Go to Online Store → Theme → Edit code
Open your theme.css file and paste the following code at the bottom:
.single-option-radio input[type=radio]:checked+label {
background-color: #000;
color: #fff;
}
Problem solved don’t forget to Like it and Mark it as Solution!
If you need help with customization/code part you can contact me for services
You can find the email in the signature below.
Regards
Guleria
Hello,
Thank for replying.
I did put the code at the bottom of theme.css, but it did not work.
Thanks
I don’t find the code I provided in theme.css
https://visualwallart.com/cdn/shop/t/7/assets/theme.css
Can you please confirm how you added it ?
You can try this code by following these steps:
Step 1: Go to the online store ->Theme ->Edit Code.
Step 2: Find the theme.liquid file and add the following code before the tag
Hopefully it will help you. If yes then Please don’t forget hit Like and Mark it as solution!
Please double check I put ir back.
I removed it when it did not work.
Thank you for replying,
I just added it, but not working
I can help you with it directly. I need to check your code. So I need to access your store as a collaborator if possible. Can you please send me your collaborator code?
Yes now css is there and you are right it’s not working.
Can you please once try to add it in theme.liquid just before tag
like this
You are the ‘Man’ … It works fine.
Thanks
It works,
Thankyou very much
Great but you mark another topic as solution.
Actually it only work for the variant type value not the variant size value.
I tried the following and it works for both variants:
.single-option-radio input[type=radio]:checked+label { background-color: #000 !important; color: #fff !important; }That was a mistake.
This is your code that worked for both variants:
.single-option-radio input[type=radio]:checked+label { background-color: #000 !important; color: #fff !important; }You can check it out
Okay Great. I updated the code.