Updating Widget Data
Provided that the web-page contains the following elements, that were designated for the Promotional Widget:
<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>
Then you can call the ChargeAfter.promotionalWidget.update() function with the following items array:
ChargeAfter.promotionalWidget.update({
items: [
{
sku: 'PRDCT1',
price: 6899.9
},
{
sku: 'PRDCT2',
price: 999.9
},
]
});
This, for example, will trigger a “monthly payment” calculation for the elements with the matching data-widget-item-sku.
Updated almost 2 years ago