> For the complete documentation index, see [llms.txt](https://developers.discountninja.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.discountninja.io/discount-ninja-developer-hub/theme-edits/code-edits/product-detail-page-pdp/badge.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://developers.discountninja.io/discount-ninja-developer-hub/theme-edits/code-edits/product-detail-page-pdp/badge.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
