Skip to main content

Quick Start

Get dynamic, localized pricing on your site in just two steps:

1. Add the Script

Paste this snippet just before the closing </head> tag on your pricing page:

2. Initialize the SDK

Copy your product ID from the listing or promotion details page:
This will automatically display a discount banner if the user is eligible for a discount.

Displaying Dynamic Prices (Basic)

The easiest way to show dynamic prices is to add the data-pd-price attribute to a wrapper element, and place a child element with data-pd-price-formatted where you want the price to appear. The SDK will automatically update this with the correct price for each visitor. Example:
That’s it! The SDK will find and update these prices automatically.

Customizing Price Display (Basic)

If you want to style different parts of the price (like the currency symbol or decimals), you can break the price into parts using these attributes inside a container with data-pd-price: Example:

SDK Configuration Options


data-props override

You can override the default properties of the price elements by adding a data-props attribute to the element. Example: In the below example, we override the showDecimal property to false.

Supported attributes

  • data-pd-show-decimal - Whether to show decimals
  • data-pd-localize-pricing - Whether to localize the pricing
  • data-pd-minimum-decimal-digits - The minimum number of decimal digits
  • data-pd-maximum-decimal-digits - The maximum number of decimal digits
  • data-pd-currency-display - The currency display format

Advanced Usage

Grouping and Strikethrough Prices

For more complex pricing layouts, you can use these advanced attributes:
  • data-pd-original-price-display: Shows a “compare at” or strikethrough price (never discounted, but can be localized).
  • data-pd-rel: Groups related price elements so they update together (e.g., main price and strikethrough).
Example:
You can assign the same data-pd-rel value to all elements that should update together.

API Reference (Advanced)

All SDK functions are asynchronous and return a Promise.
None of the below finctions inherit the configuration options set in the init function. You need to pass the options for each function call.

getUpdatedPrice

Calculate and return the updated price for a given base price (does not update the DOM):

updatePriceElement

Update a specific DOM element’s price:

updatePrice

Bulk update multiple price elements with custom templates:

Support

Need help or have questions? Reach out to us anytime at hi@paritydeals.com.