How to change the color of the variant button?

Topic summary

A user needed help changing the color of variant buttons on their Shopify product pages. After sharing a screenshot showing the default button appearance, they received assistance from multiple community members.

Solution provided:

  • Add custom CSS code to the theme.liquid file, placed above the </body> tag
  • The code targets specific product templates using template numbers to style variant buttons
  • Initial attempt failed due to a formatting issue with style tags
  • After removing an extra style tag, the solution successfully changed the button color

Follow-up question:
The user noticed the changes only apply to the specific product and asked whether they can reuse the same code for other products by simply changing the template number in the CSS. This question about scaling the customization across multiple products remains unanswered.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

1 Like

hey @Jim3 share the URLs of your website plz

Hi @Jim3
Can you kindly share your store link (with the password, if any) with us? We will check it and suggest you a solution if possible.

Hey @Jim3

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 tag


RESULT:

If I managed to solve your problem then, don’t forget to Like it and Mark it as Solution!

Best Regards,
Moeed

1 Like

Hi, @Moeed

It didnt work this time.

just removed the one style tag and then saved it

1 Like

It worked! Thank you :slightly_smiling_face:

@Mustafa_Ali In future I will make this kind of thing for next products, but I see that when I list them they are not showing with this changes. It seems that for every product I should add a different code to change the variant button color. I noticed that in the code there is a template number, if I use the same code and just change the template number with this on the new product, am I going to create this new changes for the new porduct? Thank you :slightly_smiling_face: