Shopify themes, liquid, logos, and UX
Hey all, with sense 12.0.0 i'm trying to figured out how to add a badge that display the number 48, on product grid in collection
All by using metafield
https://bv8ko0rghwg57o7l-57179668671.shopifypreview.com
Solved! Go to the solution
This is an accepted solution.
My mistake, please update code
{% assign badgeNumber = card_product.metafields.global.badge_number %}
{% if badgeNumber == 48 %}
<div class="badge">{{ badgeNumber }}</div>
{% endif %}
- Helpful? Like and Accept solution! Support me! Buy me coffee
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Ryviu: Aliexpress Reviews - AliExpress Reviews Importer, one-click import aliexpress reviews, export reviews to CSV file.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
Hello @clavilla57 ,
You can create a product meta field for the badge and add conditions to display the badge on the product grid.
Example: Create a Product Metafield: product.metafields.custom.badge
add a condition in the product grid:
{% if product.metafields.custom.badge != blank %}
{{ product.metafields.custom.badge }}
{% endif %}
where i had to put this condition?
Go to your Shopify admin.
Click on "Settings" and then "Custom data."
Click on "Products."
Under "Product details," click "Add definition" to create a new Metafield definition.
Save your Metafield definition.
{% assign badgeNumber = product.metafields.global.badge_number %}
{% if badgeNumber == 48 %}
<div class="badge">{{ badgeNumber }}</div>
{% endif %}
- Helpful? Like and Accept solution! Support me! Buy me coffee
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Ryviu: Aliexpress Reviews - AliExpress Reviews Importer, one-click import aliexpress reviews, export reviews to CSV file.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
how do i recognize where to put
{% assign badgeNumber = product.metafields.custom.badge_number %}
{% if badgeNumber == 48 %}
<div class="badge">{{ badgeNumber }}</div>
{% endif %}
Where place do you want to add this badge?
- Helpful? Like and Accept solution! Support me! Buy me coffee
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Ryviu: Aliexpress Reviews - AliExpress Reviews Importer, one-click import aliexpress reviews, export reviews to CSV file.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
Collection page. over the product image to indicate that product have "48 Capsules" pack
Please go to your card-product.liquid file, go to line 123, add code above this line of code
{%- if card_product.available == false -%}
- Helpful? Like and Accept solution! Support me! Buy me coffee
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Ryviu: Aliexpress Reviews - AliExpress Reviews Importer, one-click import aliexpress reviews, export reviews to CSV file.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
I'm not able to make it work
This is an accepted solution.
My mistake, please update code
{% assign badgeNumber = card_product.metafields.global.badge_number %}
{% if badgeNumber == 48 %}
<div class="badge">{{ badgeNumber }}</div>
{% endif %}
- Helpful? Like and Accept solution! Support me! Buy me coffee
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Ryviu: Aliexpress Reviews - AliExpress Reviews Importer, one-click import aliexpress reviews, export reviews to CSV file.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
Perfectly work
Would you mind, if u can, helping me with this?
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024