Add tips selection to the checkout
Connect JS API
Configure the tips block with the code
Ecwid.OnAPILoaded.add(function () {
Ecwid.OnPageLoaded.add(function (page) {
if (page.type == "CART") {
window.ec = window.ec || {};
ec.order = ec.order || {};
ec.order.extraFields = ec.order.extraFields || {};
ec.order.extraFields.tips = {
'type': 'toggleButtonGroup',
'options': [
{
'title': 'No tip',
},
{
'title': '5%',
'surcharge': 5
},
{
'title': '10%',
'surcharge': 10
}
],
'surchargeType': 'PERCENT',
'surchargeShortName': {
'name': 'Tip',
'showSurchargePercentValue': true,
'nameTranslated': {
'en': 'Tip',
'nl': 'Tip'
}
},
'showZeroSurchargeInTotal': false,
'required': true,
'checkoutDisplaySection': 'payment_details'
};
window.Ecwid && Ecwid.refreshConfig();
}
});
});
See also
Last updated
Was this helpful?
