Code help!

Topic summary

Goal: Show a promo line under product prices on collection pages (Sense theme) but exclude certain collections.

Context: The code was added in snippets/card.product.liquid directly under {% render ‘price’, product: card_product, price_class: ‘’ %}, inserting a static

20% OFF W/ CODE FUN20

. A screenshot was shared; the code snippet is central to understanding.

Proposed solutions:

  • Liquid setting + template approach: Wrap the promo in a conditional that outputs section.settings.sale_announcement, add a schema text setting, then create an alternate collection template. Assign this template only to collections that should display the announcement, leaving excluded collections on the default template. (A “collection template” is an alternate theme template you can assign per collection; the schema creates a theme setting.)
  • JavaScript approach: Hide the promo on specified collection pages if given the collection handle/URL.

Clarifications needed: The OP asked whether to merge the new code with the original and later noted they didn’t see any output.

Status: No confirmed resolution. Next steps: implement the conditional Liquid/template method or provide the target collection for a JS-based hide.

Summarized with AI on December 27. AI used: gpt-5.

I am using the following code to display a line of text under the product price on the collection page. This text is under every product. Is there a way to exclude a specific collection from this code? I have also attached a screenshot of what it looks like for reference.

Sense theme

www.medusasmakeup.com

snippets > card.product.liquid

UNDER THIS line 266 (approximate line)
{% render ‘price’, product: card_product, price_class: ‘’ %}

Copy below :backhand_index_pointing_down:

20% OFF W/ CODE FUN20

Hi, @medusasmakeup

I can help you with it. So I need to access your store as a collaborator if possible.

do I add this code to the original code?

I do not see anything

I prefer to do it this way.

{% render 'price', product: card_product, price_class: '' %}
{% if section.settings.sale_announcement != blank %}

{{ section.settings.sale_announcement }}

{% endif %}

{% schema %}
****
{
"type": "text",
"id": "sale_announcement",
"label": "Sale Announcement",
"default": "20% OFF W/ CODE FUN20"
}

****

{% endschema %}

Then create a collection template in the theme customization, and select this collection template if needs this text.

Hi,

It can be done with JavaScript. If you tell me which collection page you want to hide this area on, I can assist you.

Terence.