
Comfino installments
Embedding a widget on a page
To embed the widget on a product page, the following initialization code should be included:
var script = document.createElement('script');
script.onload = function () {
ComfinoProductWidget.init({
widgetKey: '{WIDGET_KEY}',
priceSelector: '{WIDGET_PRICE_SELECTOR}',
widgetTargetSelector: '{WIDGET_TARGET_SELECTOR}',
type: '{WIDGET_TYPE}',
offerType: '{OFFER_TYPE}',
embedMethod: '{EMBED_METHOD}',
priceObserverLevel: 0,
price: null
});
};
script.src = '//widget.comfino.pl/comfino.min.js';
script.async = true;
document.getElementsByTagName('head')[0].appendChild(script);
-
Available configuration options for the widget:
- widgetKey - widget API key
- priceSelector - selector of the element which contains the price of the product (eg:
span[itemprop=price]
), see: MDN Web Docs - Document.querySelector() - widgetTargetSelector - selector of the element which is the container of the widget (eg:
div.product-actions
), see: MDN Web Docs - Document.querySelector() - type - widget type (simple - textual, mixed - graphical with banner, with-modal - graphical with installments calculator)
- offerType - offer type (INSTALLMENTS_ZERO_PERCENT - 0% installments, CONVENIENT_INSTALLMENTS - convenient installments, PAY_LATER - Pay later)
- embedMethod - widget embedding method (INSERT_INTO_FIRST, INSERT_INTO_LAST - default value, INSERT_BEFORE, INSERT_AFTER)
- priceObserverLevel - DOM hierarchy level used for tracking price changes and offer recalculation (level of the observed parent container relative to the price container)
- price - product price used for installments calculation (in case if set, priceSelector option is ignored)
-
where:
- option - mandatory parameter
- option - optional parameter
Widget script hosts
- Production: https://widget.comfino.pl/comfino.min.js
- Test (sandbox): https://widget.craty.pl/comfino.min.js
Widget types
- Textual (simple)
- Graphical with banner (mixed)
- Graphical with installments calculator (with-modal)