# 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](/discount-ninja-developer-hub/theme-edits/code-edits/product-list-page-plp-and-collections/attributes.md#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](/discount-ninja-developer-hub/theme-edits/code-edits/product-list-page-plp-and-collections/badge.md), 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>
```


---

# 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://developers.discountninja.io/discount-ninja-developer-hub/theme-edits/code-edits/product-detail-page-pdp/badge.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.
