How to add extra badges

Topic summary

A user seeks guidance on adding custom badges to product pages and product cards in their Shopify store.

Initial Setup Process:

  • Navigate to Shopify Admin β†’ Settings β†’ Custom Data β†’ Metaobject definitions
  • Create a metaobject named β€œgrt_badges” with specific configuration settings (shown in screenshots)
  • Add code snippet to the card-product.liquid file: {% render 'grt_badge', product:card_product, tagtype:"card" %}
  • Enable required settings in the theme customization panel

Implementation Details:

  • Insert CSS code in theme.liquid file above the </head> tag
  • Additional code provided for styling adjustments
  • Badge can be added via app block in theme editor

Additional Requests:
The discussion expands to include:

  • Adding gray background hover effect on header menu
  • Changing menu item colors (CSS code provided)
  • Adjusting mega menu width and height (question remains unanswered)

The conversation is ongoing, with the latest question about mega menu dimensions not yet resolved.

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

How can i add extra custom badge on product page and product card

Hi @NOT1 ,

Step 1: Navigate to your Shopify Admin
Step 2: Go to Settings > Custom Data > Metaobject definations

Step 3: Put name is grt_badges and setting config like this

Done now?

1 Like

@NOT1 , Next step, Go to product metaobject

Then you need add definition. Put name is card_badge

This is config:

Hi @NOT1 , After you need add snippets. It name is grt_badge

Then add this code inside it:

{% if product.metafields.custom.card_badge %}

{% assign product = product %}

 
 {% assign grt_colorobj = product.metafields.custom.card_badge.value %}
 {% for grt_tags in grt_colorobj %}
 {% assign badge_hide = grt_tags.hide | default : false %}
 {% if grt_tags.is_image == blank %}
 {% assign badge_image = "" %}
 {% else %}
 {% assign badge_image = grt_tags.is_image %}
 {% endif %}
 {% assign border_radius = grt_tags.border_radius | default : 23 %}
 {% assign badge_name = grt_tags.text %}
 {% assign badge_bg_color = grt_tags.bg_color | default : "#0073a7" %}
 {% assign badge_text_color = grt_tags.text_color | default : "#fff" %}
 {% assign badge_pos_top = grt_tags.is_position_top %}
 {% assign badge_pos_right = grt_tags.is_alignment_right %}
 {% assign badge_top_space = grt_tags.badge_top_space | default : 8 %}
 {% assign badge_right_space = grt_tags.badge_right_space | default : 8 %}
 {% if badge_hide == false %}
 {% if tagtype == "product" %}
 
 {{badge_name}}
 
 {% else %}
 
 {% if badge_image == "" %}
 {{badge_name}}
 {% else %}
 
 {% endif %}
 
 {% endif %}
 {% endif %}
 {% endfor %}
 

{% endif %}

Hi @NOT1 , After you complete the above 2 things, we need to add this code in the card-product.liquid file.

Code:

{% render 'grt_badge' , product:card_product, tagtype:"card"  %}

Thanks

Any other steps ?

@NOT1 , Sorry i forgot a thing. We need add code in main-product.liquid

Code:

{% when 'grt_badge' %}
                 {% render 'grt_badge', badge_type: 'text', tagtype:"product" %}

Hope this can help you :heart_eyes:

oh okay it was the last step right?

@NOT1 Yes, Here is result:

BSSCommerceHDL_1-1727189024237.png

thanq

@NOT1 , No problem. Glad to help you :heart_eyes:

How can i change its position to top right

Hi @NOT1 , You need enable this setting:

Hope this can help you :heart_eyes:

How can i change its width and height

@NOT1 , Do you want like this?

I want it 18 in height and width according to the text

@NOT1 ,

Step 1: Go to Shopify Admin β†’ Online Store ->Theme β†’ Edit code

Step 2: Search file theme.liquid

Step 3: Insert this code above tag:


Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it as a solution. Thank you :heart_eyes:

How can i change the text size and weight