How do I apply a gradient to a Buy It Now button in Dawn OS 2.0?

Hi everyone,

I am currently trying to create gradient Buy It Now button on product page. I went to the code editor to change settings in the settings_schema.json file and I changed the type of accent1 from color to color_background. When I got back to the customiser, I was able to put a css code line and I can see the gradient but for a reason or another it does not apply to the button and it becomes completely white as shown on the images below.

Can someone help me to put the gradient in the button please?

Thanks in advance

Hello @Hatalogue ,

Please share:

  • your store URL;
  • page URL with the issue you mention;
  • storefront password (if your store has one).

If the store is not online yet, please follow this quick tutorial to learn how to safely and temporarily share an offline/unpublished theme URL.

Kind regards,
Diego

Hi @diego_ezfy ,

Here is the link : https://c3crl3r73p5zrdqj-19684491326.shopifypreview.com

you can go on any product pages

Thank you

@Hatalogue ,

  1. In your Shopify Admin go to online store > themes > actions > edit code
  2. In your theme.liquid file, find the (press CTRL + F or command + F on Mac)
  3. paste this code right above the tag:

You can change the colors as you wish:

#fff = text color
#000 = border color

To change the gradient color:

  1. Access this website and generate the gradient.
  2. Copy only the second line

  1. Delete the 3rd line on the code I shared, the one starting with ‘background’.
  2. Replace with the new code you copied from step 2. Make sure it ends with a ;

Kind regards,
Diego

Hi @diego_ezfy ,

The code lines didn’t changed the right buttons.

@Hatalogue

I’m not sure if I understand what you mean. Do you want only the currently selected button to change color? If so, you can replace the previous code with the following:


Hi @diego_ezfy ,

I want to make the gradient color for the Buy it now button. As you can see on the first post, the button is grey. When I changed the settings to make it gradient, the button became white and disappear.

You can use this code then


Hi @diego_ezfy ,

Thank you very much for your help :100: :100: :100:

It worked ! :smiling_face_with_sunglasses: :smiling_face_with_sunglasses: :smiling_face_with_sunglasses:

Hello Diego! Sorry to revive an old thread but I was wondering how you would apply this gradient to the add to cart button? Also, would it be possible to apply this gradient to the rest of the buttons in the cart/checkout process? Side note, the variant-selector button gradient snippet you provided in 2021 still works perfectly! Thanks!

@diego_ezfy , sorry forgot to tag you

this isnt working for me can you help me make all the buttons a gradient colour