> For the complete documentation index, see [llms.txt](https://developer.esw.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.esw.com/light-touch-integration/features/dynamic-pricing/technical-details.md).

# Technical Details

This page covers the technical details for LTI dynamic pricing in [Dynamic Pricing](/light-touch-integration/features/dynamic-pricing.md).

### How dynamic pricing works

LTI converts shopper-facing prices by using your ESW pricing configuration.

It applies only to countries managed by ESW for pricing and checkout.

LTI watches the page for content changes. When prices, quantities, or cart content change, it scans the configured selectors again and reapplies pricing.

This process uses a mutation observer. It keeps pricing aligned on product pages, carts, minicarts, and other dynamic storefront components.

### Base price requirement

Dynamic pricing depends on the retailer base price for each product.

Store that base value in the `data-bp-lti` attribute. LTI uses it as the source value for conversion.

If the base value is missing or inconsistent, storefront pricing may not match checkout pricing.

### Required selectors

Use the following selectors so LTI can find prices and recalculate totals.

#### Any page

* `.esw-general-price`\
  Marks any price that LTI should localize.

#### Product page and add-to-cart popup

* `.esw-single-item`\
  Wraps a product block that needs subtotal calculation.
* `.esw-single-item-price`\
  Marks the localized unit price inside the product block.
* `.esw-single-item-quantity`\
  Marks the product quantity inside the product block.
* `.esw-single-item-subtotal`\
  Marks the element where LTI writes the calculated subtotal.

#### Cart page

* `.esw-cart-item`\
  Wraps each cart line item.
* `.esw-item-price`\
  Marks the price for a cart line item.
* `.esw-item-quantity`\
  Marks the quantity for a cart line item.
* `.esw-item-subtotal`\
  Marks the element where LTI writes the cart line subtotal.
* `.esw-cart-subtotal`\
  Marks the element where LTI writes the full cart subtotal.
* `.esw-cart-discount`\
  Marks cart-level discounts used in total calculation.
* `.esw-order-total`\
  Marks the element where LTI writes the final order total.

#### Minicart

* `.esw-minicart-item`\
  Wraps each minicart line item.
* `.esw-minicart-item-price`\
  Marks the price for a minicart line item.
* `.esw-minicart-item-quantity`\
  Marks the quantity for a minicart line item.
* `.esw-minicart-item-subtotal`\
  Marks the element where LTI writes the minicart line subtotal.
* `.esw-minicart-subtotal`\
  Marks the element where LTI writes the minicart subtotal.
* `.esw-minicart-discount`\
  Marks minicart-level discounts used in total calculation.
* `.esw-minicart-order-total`\
  Marks the element where LTI writes the minicart order total.

#### Checkout handoff

* `.esw-checkout-button`\
  Marks the checkout button that should redirect to ESW checkout when the selected country is ESW-managed.

This selector is used only for the custom platform integration path through the Callback API.

### Calculation behavior

{% stepper %}
{% step %}

#### Find price elements

LTI scans the page for the configured selectors.
{% endstep %}

{% step %}

#### Convert visible prices

LTI localizes each supported price using the ESW pricing configuration.
{% endstep %}

{% step %}

#### Recalculate item subtotals

Where item wrapper, price, quantity, and subtotal selectors exist together, LTI recalculates the subtotal from the localized unit price and quantity.
{% endstep %}

{% step %}

#### Rebuild cart or minicart totals

LTI sums the localized item subtotals to generate the cart or minicart subtotal.
{% endstep %}

{% step %}

#### Apply discounts

If cart-level discount selectors are present, LTI subtracts those values from the subtotal to calculate the order total.
{% endstep %}

{% step %}

#### Update checkout behavior

If the selected country is ESW-managed, LTI can redirect the marked checkout button to ESW checkout.
{% endstep %}
{% endstepper %}

### Implementation notes

* Add `.esw-general-price` to every shopper-facing price that should localize.
* Use the wrapper and child selectors together for subtotal calculations.
* Ensure quantity elements expose a clean numeric value.
* Provide dedicated subtotal and total elements if you want LTI to write calculated values.
* Keep cart and minicart structures stable after render so LTI can detect updates correctly.

{% hint style="info" %}
Keep your selector setup and ESW country configuration aligned. If selectors are missing or values do not map to the configured country-currency pairs, storefront totals may be incomplete or inconsistent.
{% endhint %}

For implementation support or selector validation, contact your ESW point of contact.


---

# 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://developer.esw.com/light-touch-integration/features/dynamic-pricing/technical-details.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.
