Adding color label to my color swatches in Shoptimize Product Page

Solved

Adding color label to my color swatches in Shoptimize Product Page

Gustav001
Excursionist
14 1 0

Hi,

I have color swatches on my product page but on click or hover, they don't display the color label. This is for Shoptimize theme. I need to show the labels so that customer know exactly which product they are selecting.
I have checked all the settings and cannot find where to set this. Looks like it needs custom code?

Please advise.

Accepted Solutions (2)
vinh0225
Shopify Partner
128 26 25

This is an accepted solution.

Hi,

 

I updated the codebase.
Please check. https://www.gardensgenie.com/collections/fire-pit-tables/products/alameda-fire-table-60-concrete-top

vinh0225_0-1722851401857.png

Please let me know if you have any concern.

 

Regards,

Vinh

Was my response useful?  Click Like to let me know!
Was your query resolved? ✓ Mark it as a Resolved Solution
If you need custom Shopify changes, ️you can hire me.
Contact me at  ✉️ jalicorich@gmail.com.

View solution in original post

Gustav001
Excursionist
14 1 0

This is an accepted solution.

@vinh0225 - as per our other chat, thank you very much for your great help!  It all works perfectly now. 

Regards,

Gustav

View solution in original post

Replies 8 (8)

ProtoMan44
Shopify Partner
704 57 112

@Gustav001 Hey, thanks for posting here. if you have no idea about liquid code so please use an app like Globo product option etc.

- A thirsty developer passionate about supporting the community. If you'd like to, you can  

Buy me a Coffee.


- Your Shopify Solution Specialist Get a Quote at

ProtoMan44

 - 

Chat On Whatsapp


Crafting exceptional e-commerce experiences to elevate your online presence. Let's build your success story together!
ProtoMan44
Shopify Partner
704 57 112

@Gustav001 first you can creat a text feild to match option color as the option title 
add schema in shopify theme setting:

{
  "name": "Product Option Colors",
  "id": "product_option_colors",
  "type": "text",
  "default": "Black: #000, White: #fff",
  "info": "Enter color mappings in the format 'Name: #Hex, Name: #Hex'"
}


then add liquid code which is needed its a sample :

{% assign color_mappings = settings.product_option_colors | split: ',' %}
{% assign color_map = '' %}

{% for mapping in color_mappings %}
  {% assign parts = mapping | split: ':' %}
  {% if parts.size == 2 %}
    {% assign color_name = parts[0] | strip %}
    {% assign color_value = parts[1] | strip %}
    {% assign color_map = color_map | append: '{ "' | append: color_name | append: '": "' | append: color_value | append: '" }' %}
  {% endif %}
{% endfor %}

{% assign color_map = color_map | replace: '}{', '},{' %}
{% assign color_map = '[' | append: color_map | append: ']' %}
{% assign color_map = color_map | parse_json %}

{% for option in product.options_with_values %}
  {% for value in option.values %}
    {% assign color = '' %}
    {% for map in color_map %}
      {% if map.first == value %}
        {% assign color = map.last %}
      {% endif %}
    {% endfor %}
    <div class="product-option" data-value="{{ value }}" style="background-color: {{ color }}">
      {{ value }}
    </div>
  {% endfor %}
{% endfor %}


understand the color mapping to apply background color

- A thirsty developer passionate about supporting the community. If you'd like to, you can  

Buy me a Coffee.


- Your Shopify Solution Specialist Get a Quote at

ProtoMan44

 - 

Chat On Whatsapp


Crafting exceptional e-commerce experiences to elevate your online presence. Let's build your success story together!

vinh0225
Shopify Partner
128 26 25

Hi @Gustav001 

 

If you add "title", it will show a tooltip.

vinh0225_0-1722610043553.png

However, it is necessary to update liquid file.
If you allow me to access your store, I can help you definitely.

 

Regards,

Vinh

Was my response useful?  Click Like to let me know!
Was your query resolved? ✓ Mark it as a Resolved Solution
If you need custom Shopify changes, ️you can hire me.
Contact me at  ✉️ jalicorich@gmail.com.
Gustav001
Excursionist
14 1 0

@vinh0225- thank you for your reply.

My store is www.gardensgenie.com. A sample page (with color swatches is: https://www.gardensgenie.com/collections/fire-pit-tables/products/alameda-fire-table-60-concrete-top...

Let me know what you need.

vinh0225
Shopify Partner
128 26 25

@Gustav001 

If you want this, it is necessary to update a liquid code.

vinh0225_0-1722653033689.png

If you are not familiar with code, I can help you and I will require access to your store admin.
If you don't mind, please let me know your collaborator access request code so that I can send a request.
Here is how to get it:

To get a collaborator request code on Shopify, you can do the following:
  1. Log into your Shopify store
  2. Go to Settings
  3. Select Users and permissions
  4. Scroll down to the Collaborators section
  5. Select the option that only people with a code can request to edit your store
  6. Click Generate new code
  7. Click Generate code again to confirm
  8. Copy the code and share it with me via private message.

Regards,
Vinh

Was my response useful?  Click Like to let me know!
Was your query resolved? ✓ Mark it as a Resolved Solution
If you need custom Shopify changes, ️you can hire me.
Contact me at  ✉️ jalicorich@gmail.com.
Gustav001
Excursionist
14 1 0

@vinh0225- how do I PM you?

vinh0225
Shopify Partner
128 26 25

This is an accepted solution.

Hi,

 

I updated the codebase.
Please check. https://www.gardensgenie.com/collections/fire-pit-tables/products/alameda-fire-table-60-concrete-top

vinh0225_0-1722851401857.png

Please let me know if you have any concern.

 

Regards,

Vinh

Was my response useful?  Click Like to let me know!
Was your query resolved? ✓ Mark it as a Resolved Solution
If you need custom Shopify changes, ️you can hire me.
Contact me at  ✉️ jalicorich@gmail.com.
Gustav001
Excursionist
14 1 0

This is an accepted solution.

@vinh0225 - as per our other chat, thank you very much for your great help!  It all works perfectly now. 

Regards,

Gustav