I’m looking for help adding a custom label/badge to the Be Yours theme. They offer an option in a meta description setup but I would rather use a simple code for automation of product tags vs having to select the option in inventory entry.
I have one already in place “pre-owned” though I can’t remember how I did this. So I would like to start over the right way. I would like the ame blue badge as I have now with another variant of text - sale, local (for local artisans), new. etc
website www.inplacejh.com/shop
Hi - yes I would really appreciate the step by step. I have tried to retrace my steps for the original pre-owned coding and Im lost.
Thank you.
Hi @catch22 ,
I’d be happy to help you set up an automated badge system for your Be Yours theme! Looking at your current “PRE-OWNED” badge, I can see exactly how it’s structured, which makes this much easier to replicate.
Here’s how to create an automated system using product tags:
Step 1: Set Up Your Product Tags First, you’ll want to standardize your product tags in Shopify. Use simple, consistent tags like:
- badge-sale
- badge-local
- badge-new
- badge-preowned
Step 2: Modify Your Product Card Template You’ll need to edit your theme’s product card template (usually found in snippets/card-product.liquid or similar). Replace your current badge code with something like this:
{% if product.tags contains 'badge-preowned' or product.tags contains 'badge-sale' or product.tags contains 'badge-local' or product.tags contains 'badge-new' %}
<div class="card__badge">
{% if product.tags contains 'badge-preowned' %}
<span class="badge" style="--color-badge-background: #343f5c; --color-badge-border: var(--color-badge-background); --color-badge-foreground: #ffffff;">
PRE-OWNED </span>
{% elsif product.tags contains 'badge-sale' %}
<span class="badge" style="--color-badge-background: #d73527; --color-badge-border: var(--color-badge-background); --color-badge-foreground: #ffffff;">
SALE </span>
{% elsif product.tags contains 'badge-local' %}
<span class="badge" style="--color-badge-background: #2d7a2d; --color-badge-border: var(--color-badge-background); --color-badge-foreground: #ffffff;">
LOCAL </span>
{% elsif product.tags contains 'badge-new' %}
<span class="badge" style="--color-badge-background: #ff6b35; --color-badge-border: var(--color-badge-background); --color-badge-foreground: #ffffff;">
NEW </span>
{% endif %}
</div>
{% endif %}
Step 3: Apply to Product Pages Too You’ll also want to add similar logic to your main product page template (sections/product-form.liquid or similar) so badges appear consistently.
Step 4: Add the Tags Now you can simply add the appropriate tag to any product (like badge-sale) and the badge will automatically appear!
This approach gives you complete automation - just tag your products and the badges appear automatically. Much easier than manually setting options for each product!
Let me know if you need help implementing this or if you’d like me to adjust the colors or add more badge types.
Best,
Shubham | Untechnickle