Unified Shipping Module - Configuration

Configuration Options

The unified shipping module appearance and behaviour can be influenced by configuration options. All configuration options are used by setting the respective properties on the "window.porterbuddy" object.

Available configuration options - items in bold are required

Key Type Description
homeDeliveryOptions ShippingOption[] Configures the home delivery options to be displayed. If undefined is passed, the category "Home Delivery" will not be shown. If an empty array is passed, the category will be shown as inactive.
pickupPointOptions ShippingOption[] Configures the options for delivery to a pickup point to be displayed. If undefined is passed, the category "Pickup Point Delivery" will not be shown, if an empty array is passed, it will be shown as inactive.
storeOptions ShippingOption[] Configures the options for store pickup to be displayed. If undefined is passed, the category "Store Pickup" will not be shown, if an empty array is passed, it will be shown as inactive.
resetContext boolean If set to true, all previously set properties will be reset to the default value if not defined with a new value in this context
showPostCodeInput boolean Shows a postcode input field in the consolidated checkout. When a postcode is entered, "onPostCodeEntered" is called. Default value: false
storePostCode boolean Stores the postCode as a cookie and re-uses the stored postcode when displaying the post code input if no recipient info is specified in the options. The same cookie as for the product card widget is used, so a postcode entered there will also be used un the checkout
storedPostCodeDelay number Sets the delay between a successful reading of a stored postcode from a cookie and the call to "onPostCodeEntered". A call to "setRecipientInfo" to set the postcode from external sources will cancel this delay and immediately call "onPostCodeEntered".
postCodeEditable boolean Defines if the postcode input field should be editable by the user. Only has any effect if the postcode input is shown
now string For testing only. Hardcode the value of now to get predictable results when testing with test data and date functions
text CheckoutText Texts used in the consolidated checkout
language NO | EN Language is necessary when custom texts are provided. It will set proper variable texts regarding the language set. By default language is detected by users browser setting
recipientInfo RecipientInfo Info about the delivery recipient
enableHtmlDescriptions boolean If enabled, the values of the description properties of the various shipping options are interpreted as html content. WARNING:This is -in essence- HTML injection and allows for breaking the unified shipping module layout. If you chose to use this, make sure to not include any tags that might have serious side effects for the widget layput. Default value is false.
onSelectionChanged function(category: ShippingCategory, selected: SelectedShipping) Function that is called when the selected delivery option changes. The argument "category" contains which shipping category is selected (home, pickupPoint, store) and "selected" contains the detail data for the selected shipping option.
onUnselectedShipping function() Function that is called when the previously selected shipping option becomes unavailable, e.g. because the shipping options were updated and do not contain the previously selected one anymore
onPostCodeEntered function(postCode: string) Function that is called when the user enters a PostCode
selectionPropertyChangeListeners SelectionPropertyChangeListener[] An array of listeners for property changes of the selected shipping option. The onChange method of each listener gets called when the shipping option with the specified id is selected and the value of the property described by the property path changes. If a listener is registered and only the registered property path changes, the regular callback on selection changes is not called.
lastSelectedOptionInCategory LastSelectedOptionInCategory It will store the most recent selected option from customer regarding category
onSetCallbacks function(callbacks: CheckoutCallbacks) Function that gets called after initialization of the consolidated checkout. The function argument is an object containing callback function references, which can be used to to interact with the checkout from external scripts.
colorScheme ColorScheme Color scheme definition to override default colors, see color scheme documentation page for effects.