# How to use the Metafield Image Badge block

The Metafield Image Badge block allows you to display custom badges or icons on your product cards using metafield values. This is perfect for showing certifications, special labels, or promotional badges.

### Setting Up Your Metafields

Before using the badge block, you'll need to set up your product metafields:

1. Go to Settings > Custom data > Products
2. Click Add definition
3. Configure your metafield:
   * Type: File reference
   * Namespace: (e.g., "badges")
   * Key: (e.g., "special\_offer")
   * Name: (e.g., "Special Offer Badge")

### Adding a Metafield Badge Block

* In your Featured Collection - Blocks section, add a new block
* Select "Metafield image badge"
* Configure the following settings:

#### Basic Settings

* Metafield namespace: Enter your metafield namespace (e.g., "badges")
* Metafield key: Enter your metafield key (e.g., "special\_offer")

#### Position Settings

* Badge horizontal position: -10% to 90% (0% = left edge)
* Badge vertical position: -10% to 90% (0% = top edge)
* Badge size: 10% to 100% of product card width
* Badge angle: -45° to 45° rotation

#### Animation Settings

* Rotation: 0-40 seconds (0 = no rotation)
* Opacity: 10-100%

#### Image Settings

* Image aspect ratio: Choose from:
* Landscape (4:3)
* Portrait (2:3)
* Square (1:1)
* Original
* Image rounded corners: 0-50%

#### Mobile Settings

* Hide on smaller screens: Toggle to hide badges on mobile devices

### Best Practices

1\. Image Preparation

* Use PNG files with transparent backgrounds
* Keep file sizes small (under 100KB)
* Use consistent dimensions for all badges
* Positioning
* Avoid overlapping with product images or text
* Consider how badges will look at different screen sizes
* Test positions with various product image aspect ratios
* Mobile Optimization
* Consider hiding complex badges on mobile
* Use smaller badge sizes for mobile displays
* Test on multiple devices
* Performance
* Limit the number of animated badges per page
* Optimize image files for web use
* Consider using static badges for better performance

### Troubleshooting

If your badge isn't appearing:

* Verify the metafield namespace and key are correct
* Check that the product has an image uploaded to the metafield
* Ensure the badge size is large enough to be visible
* Check if the position values place the badge within view
* Verify mobile display settings if testing on smaller screens

### Advanced Tips

#### Layering Multiple Badges

You can add multiple metafield badge blocks to create layered effects:

* Add separate metafield badge blocks
* Use different position values
* Adjust z-index using Custom CSS if needed

#### Seasonal Badges

Create different metafields for seasonal badges:

* badges.holiday\_special
* badges.summer\_sale
* badges.new\_arrival

#### Custom CSS Styling

Add these to your section's Custom CSS field:

```css
.dsgn-pck__product-tag--image {
  transition: transform 0.3s ease;
}

.dsgn-pck__product-tag--image:hover {
  transform: scale(1.1);
}
```

### Examples Use Cases

1\. Certifications

* Organic certification badges
* Fair trade symbols
* Quality assurance stamps
* Promotional
* Sale badges
* New arrival markers
* Limited edition labels
* Product Features
* Eco-friendly indicators
* Vegan/vegetarian symbols
* Award badges

Remember to keep your badges consistent with your brand aesthetic and ensure they enhance rather than overwhelm your product presentations.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://design-packs.gitbook.io/docs/fundamentals/section-tutorials/featured-collection-blocks/how-to-use-the-metafield-image-badge-block.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
