Updating Widget Data

Define promotional widget placeholders on a web-page.

<div class="ca-promotional-widget" 
     data-widget-item-sku="PRDCT1" 
     data-widget-item-price="7999.99">
</div>

<!-- Page Content -->

<div class="ca-promotional-widget" 
     data-widget-item-sku="PRDCT2" 
     data-widget-item-price="1999.99">
</div>

Next make a call for ChargeAfter.promotionalWidget.update() function with the placeholders to be updated.

// updates a specific widgets
ChargeAfter.promotions.update([{sku:'some product sku',price:5000}]);

// all widgets update
ChargeAfter.promotions.update();

The code above triggers monthly payment calculation for elements that match data-widget-item-sku ID.


What’s Next