How do I code a custom badge in the Prestige theme?

Topic summary

A user seeks help adding a second custom badge to their Prestige theme Shopify store, as they’re already using the theme’s built-in custom badge feature.

Initial Solution Proposed:

  • Create a product metafield for the custom badge
  • Modify the product-item.liquid file to display badges from metafields

Implementation Challenges:

  • The Prestige theme doesn’t have a product-item.liquid file
  • The relevant code exists in product-card.liquid and product-badges.liquid files instead
  • Initial code modifications disrupted the existing sale badge functionality, causing it to display “Off” text on all products or removing the sale badge entirely

Technical Details:

  • The solution involves inserting metafield logic into the badge rendering code
  • Code must be placed carefully to preserve existing badge types (sale, sold out, discount)
  • The custom badge metafield reference is product.metafields.custom.custom_badge

Current Status:
The issue remains unresolved after multiple code iterations. The developer offering assistance has suggested connecting via direct message or email to complete the customization, indicating it’s a small task requiring precise code placement.

Summarized with AI on November 10. AI used: claude-sonnet-4-5-20250929.

Hello,

Thank you for your response.

Please find the code as requested:

{%- comment -%}
----------------------------------------------------------------------------------------------------------------------
PRODUCT BADGES COMPONENT
----------------------------------------------------------------------------------------------------------------------
This component is used in product listing and product page to render the badges of a given product
********************************************
Supported variables
********************************************
* product: the product to render the badges
* variant: the specific variant to show the badge from
* vertical: if set to true, the badges are outputted vertically
* types: the types of badge to output. Can be "custom", "sold_out" or "discount" (or a combination separated by comma). If nothing is set, all badges are outputted.
* form_id: an optional form ID to use to update the badges when a given variant changes
{%- endcomment -%}
{%- liquid
assign badge_types = types | default: 'custom, sold_out, discount' | split: ','
assign variant = variant | default: product.selected_or_first_available_variant
-%}
{%- assign is_badge_list_hidden = true -%}
{%- capture badges -%}
{%- for badge_type in badge_types -%}
{%- assign stripped_badge_type = badge_type | strip -%}
{%- case stripped_badge_type -%}
{%- when 'custom' -%}
{%- assign custom_badges = product.metafields.custom.badges.value -%}
{%- for custom_badge in custom_badges -%}
{%- assign is_badge_list_hidden = false -%}
{{ custom_badge }}
{%- endfor -%}
{%- when 'sold_out' -%}
{%- if settings.show_sold_out_badge -%}
{%- if variant.available == false or form_id != blank -%}
{%- unless variant.available -%}
{%- assign is_badge_list_hidden = false -%}
{%- endunless -%}

{%- endif -%}
{%- endif -%}
{%- when 'discount' -%}
{%- if settings.show_discount -%}
{%- assign is_variant_on_sale = false -%}
{%- if variant.compare_at_price > variant.price -%}
{%- assign is_variant_on_sale = true -%}
{%- assign is_badge_list_hidden = false -%}
{%- endif -%}
{%- if product.compare_at_price > product.price -%}
{%- if settings.discount_mode == 'percentage' -%}
{%- assign savings = variant.compare_at_price | minus: variant.price | times: 100.0 | divided_by: variant.compare_at_price | round | append: '%' -%}
{%- else -%}
{%- capture savings -%}{{ variant.compare_at_price | minus: variant.price | money }}{%- endcapture -%}
{%- endif -%}
{% if product.metafields.custom.custom_badge !=blank %}
{{ product.metafields.custom.custom_badge }}
{% else %}

{% endif %}
{%- endif -%}
{%- endif -%}
{%- endcase -%}
{%- endfor -%}
{%- endcapture -%}
{%- if badges != blank -%}

{%- endif -%}

If you have any concern, please let me know.

Regards,

San