Change Colour of Checkbox on check-out & Order notes box

Solved

Change Colour of Checkbox on check-out & Order notes box

FOP
Explorer
114 0 17

Hi,
I am looking to see if I can change the colour of our check boxes from blue to our custom pink colour?  Also, the text boxes we have are not the same size.  How do I go about having these a standard size so they match.

 

Screen Shot 2022-10-01 at 19.30.20.png

Accepted Solution (1)
HendrikBr
Shopify Partner
15 2 0

This is an accepted solution.

This is what you need to do:

Go in to your code editor and look for base.css -> input[type='checkbox'] and add: accent-color: #fbc8be;

 

It should look like this:

input[type='checkbox'] {
display: inline-block;
width: auto;
margin-right0.5rem;
accent-color: #fbc8be;
}

 

 

View solution in original post

Replies 8 (8)

HendrikBr
Shopify Partner
15 2 0

Hey @FOP !

 

Can you please share your Store URL? So i can provide you the css code you need to add to your theme.css file.

 

Thanks!

FOP
Explorer
114 0 17
HendrikBr
Shopify Partner
15 2 0

This is an accepted solution.

This is what you need to do:

Go in to your code editor and look for base.css -> input[type='checkbox'] and add: accent-color: #fbc8be;

 

It should look like this:

input[type='checkbox'] {
display: inline-block;
width: auto;
margin-right0.5rem;
accent-color: #fbc8be;
}

 

 

FOP
Explorer
114 0 17

@HendrikBr Thank you, it worked,  Did you happen to know about the text boxes and how to fix those?

 

Also, the text boxes we have are not the same size.  How do I go about having these a standard size so they match.

HendrikBr
Shopify Partner
15 2 0

Your welcome!

 

Can you please explain and give screenshots to make sure what you want.

FOP
Explorer
114 0 17

Hi There,
The text boxes are different sizes, any chance to make the top one the same format as the bottom?

 

Thanks

Screen Shot 2022-10-02 at 22.18.55.png

HendrikBr
Shopify Partner
15 2 0

There are multiple ways to do that. 

Easiest solution would be to find the html element in your code and add style="width:350px;"

FOP
Explorer
114 0 17
{% if linklists.gift-wrapping.links.size > 0 and
linklists.gift-wrapping.links.first.type == 'product_link' %}

<div
  id="is-a-gift"
  style="clear: left; margin: 30px 0"
  class="clearfix rte"
>
  <p>
    <input
      id="gift-wrapping"
      type="checkbox"
      name="attributes[gift-wrapping]"
      value="yes"
      {% if cart.attributes.gift-wrapping %}
      checked="checked"
      {% endif %}
      style="float: none"
    />
    <label
      for="gift-wrapping"
      style="display:inline; padding-left: 5px; float: none;"
  
    >
      Please gift wrap my order for {{ linklists.gift-wrapping.links.first.object.price | money }}
    </label>
  </p>
  <p>
    <label style="display:block" for="gift-note"

      >Gift Message (Optional):</label
    >
<textarea id="note" name="note" rows="2" class="" maxlength="200"></textarea>
{{ cart.attributes.gift-note }}</textarea
    >
  </p>
</div>

{% assign id = linklists.gift-wrapping.links.first.object.variants.first.id
%} {% assign gift_wraps_in_cart = 0 %} {% for item in cart.items %} {% if
item.id == id %} {% assign gift_wraps_in_cart = item.quantity %} {% endif %}
{% endfor %}

<style>
  #updates_{{ id }} { display: none; }
</style>

<script>

  Shopify.Cart = Shopify.Cart || {};

  Shopify.Cart.GiftWrap = {};

  Shopify.Cart.GiftWrap.set = function() {
    var headers = new Headers({ 'Content-Type': 'application/json' });

    var request = {
      method: 'POST',
      headers: headers,
      body: JSON.stringify({ updates: { {{ id }}: 1 }, attributes: { 'gift-wrapping': true } })
    };
    fetch('/cart/update.js', request)
    .then(function() {
      location.href = '/cart';
    });
  }

  Shopify.Cart.GiftWrap.remove = function() {
    var headers = new Headers({ 'Content-Type': 'application/json' });

    var request = {
      method: 'POST',
      headers: headers,
      body: JSON.stringify({ updates: { {{ id }}: 0 }, attributes: { 'gift-wrapping': '', 'gift-note': '' } })
    };
    fetch('/cart/update.js', request)
    .then(function() {
      location.href = '/cart';
    });
  }

  // If we have nothing but gift-wrap items in the cart.
  {% if cart.items.size == 1 and gift_wraps_in_cart > 0 %}
  document.addEventListener("DOMContentLoaded", function(){
    Shopify.Cart.GiftWrap.remove();
  });
  // If we have more than one gift-wrap item in the cart.
  {% elsif gift_wraps_in_cart > 1 %}
  document.addEventListener("DOMContentLoaded", function(){
    Shopify.Cart.GiftWrap.set();
  });
  // If we have a gift-wrap item in the cart but our gift-wrapping cart attribute has not been set.
  {% elsif gift_wraps_in_cart > 0 and cart.attributes.gift-wrapping == blank  %}
  document.addEventListener("DOMContentLoaded", function(){
    Shopify.Cart.GiftWrap.set();
  });
  // If we have no gift-wrap item in the cart but our gift-wrapping cart attribute has been set.
  {% elsif gift_wraps_in_cart == 0 and cart.attributes.gift-wrapping != blank  %}
  document.addEventListener("DOMContentLoaded", function(){
    Shopify.Cart.GiftWrap.set();
  });
  {% endif %}

  // When the gift-wrapping checkbox is checked or unchecked.
  document.addEventListener("DOMContentLoaded", function(){
    document.querySelector('[name="attributes[gift-wrapping]"]').addEventListener("change", function(event) {
      if (event.target.checked) {
        Shopify.Cart.GiftWrap.set();
      } else {
        Shopify.Cart.GiftWrap.remove();
      }

    });

    document.querySelector('#gift-note').addEventListener("change", function(evt) {
      var note = evt.target.value;
      var headers = new Headers({ 'Content-Type': 'application/json' });

      var request = {
        method: 'POST',
        headers: headers,
        body: JSON.stringify({ attributes: { 'gift-note': note } })
      };

      fetch('/cart/update.js', request);
    });
  });
</script>

{% else %}

<p style="clear: left; margin: 30px 0" class="rte">
  You attempted to add a gift-wrapping script to your shopping cart, but it
  won't work because you don't have a link list with handle
  <code>gift-wrapping</code> which, in turn, contains a link to your
  gift-wrapping product. Please review the steps outlined
  <a
    href="https://help.shopify.com/manual/online-store/themes/os/customize/add-gift-wrap-option"
    target="_blank"
    rel="noopener noreferrer nofollow"
    >here</a
  >.
</p>

{% endif %}

Not sure where in the code to enter it?  I have tried a few places and it doesn't work