With the following code provided you can either inject your own donation amounts into the widget or set default interval and default amount when loading the widget.
Unfortunately, it is not possible to link the default amounts to donation purposes.
<script type="text/javascript"> window.rnwWidget = window.rnwWidget || {}; window.rnwWidget.configureWidget = window.rnwWidget.configureWidget || []; window.rnwWidget.configureWidget.push(function(options) {
// Overrwite predefined amounts (recurring amounts are monthly values) options.translations.step_amount.recurring_amounts = [{text: '5', value: '500'}, {text: '10', value: '1000'}]; options.translations.step_amount.onetime_amounts = [{text: '50', value: '5000'}, {text: '100', value: '10000'}, {text: '200', value: '20000'}]
// Set widget default to recurring payment and interval to quarterly options.defaults['recurring_interval'] = 'quarterly';
// Set default for recurring interval to quarterly options.defaults['recurring_interval_name'] = 'quarterly';
// Set default for recurring interval UI element to quarterly options.defaults['ui_recurring_interval_default'] = 'quarterly';
// Set recurring interval in respective language used in LSV application forms
options.defaults['stored_translated_recurring_interval'] = 'vierteljährlich';
// The select-dropdown has to be touched for the change to be visible options.widget.on( window.rnwWidget.constants.events.WIDGET_LOADED, function(event) { event.widget.j('[name="interval-selector"]').val(options.translations.common.quarterly).trigger('change'); });
// Set default amount in currency subunit
// In this example (CHF/EUR/USD/.. 10) options.defaults['ui_recurring_amount_default'] = '1000';
// Set default amount for one-time payment in currency subunit
// In this example (CHF/EUR/USD/.. 10) options.defaults['ui_onetime_amount_default'] = '1000'; // Optionally: set purpose explicitly, hide purpose-selection options.defaults['stored_campaign_id'] = 'test-campaign-id'; options.defaults['stored_campaign_subid'] = 'test-subcampaign-id'; options.defaults['stored_purpose'] = 'test-purpose'; options.widget.on(window.rnwWidget.constants.events.WIDGET_LOADED, function (event) { event.widget.hideStep('donation-target'); }) }); </script>
Comments
0 comments
Please sign in to leave a comment.