# Badge

{% hint style="info" %}
The instructions in this article constitute a workaround to show a badge on the Product Detail Page (PDP) that is originally designed to be displayed on the Product List Page (PLP) and Collections. The style and text of the badges displayed on the PDP cannot be managed separately.
{% endhint %}

## Attributes

Add the data attributes, documented [here](https://developers.discountninja.io/discount-ninja-developer-hub/theme-edits/product-list-page-plp-and-collections/attributes#snippet), around the section where you want to display the badge.

## Price

In order for the badge to work, a price section must be included inside the elemented that has the attributes. This section should be hidden.

Example:

```html
<span style="display:none" data-la-dn-price></span>
```

## Badge

Optionally, add the badge class, documented [here](https://developers.discountninja.io/discount-ninja-developer-hub/theme-edits/code-edits/product-list-page-plp-and-collections/badge), on the element that should act as the parent of the badge.

## Example

```html
<div id="my-product-page-image-gallery"
     data-la-dn-product-handle="{{ product.handle }}" 
     data-la-dn-product-id="{{ product.id }}" 
     data-la-dn-product-collection-handles="{{ product.collections | map: 'handle' | join: ',' | default: '[[--NONE--]]' }}" 
     data-la-dn-product-collection-ids="{{ product.collections | map: 'id' | join: ',' | default: '[[--NONE--]]' }}" 
     data-la-dn-product-available="{{ product.available}}" 
     data-la-dn-product-price="{{ product.first_available_variant.price | default: product.price }}"
     data-la-dn-product-compare-at-price="{{ product.first_available_variant.compare_at_price | default: product.first_available_variant.price | default: product.compare_at_price | default: product.price }}" 
     data-la-dn-product-compare-at-price-varies="{{ product.compare_at_price_varies }}"
     data-la-dn-product-price-varies="{{ product.price_varies }}" 
     data-la-dn-product-price-min="{{ product.price_min }}"
     data-la-dn-product-tags="{{ product.tags | join: ',' | escape | default: '[[--NONE--]]' }">
    ...
    <span style="display:none" data-la-dn-price></span>
    ...
    <div id="my-product-page-image" class="la-dn-collection-badge">
        <img>
        ...
    </div>    
</div>
```
