Builds a custom shopping cart checkout rule type contributed by this app. Obtained from checkoutRuleTypeBuilder on the controller mappings. A checkout rule can inspect the cart items before checkout is allowed and can take part in processing the checkout itself. Set the two function names and any configuration fields, then call build to register the rule type.

Group: Builders


Methods

checkItemsFn(String s)

Returns: CheckoutRuleTypeBuilder

Names the function called to check the items in the cart against this rule, which is what allows the rule to block or warn about a checkout.

ParameterDescription
sname of the global JavaScript function that checks the cart items

processCheckoutFn(String s)

Returns: CheckoutRuleTypeBuilder

Names the function called when the checkout is processed, letting the rule do its own work as part of completing the order.

ParameterDescription
sname of the global JavaScript function that processes the checkout

addTextField(String id, String text, boolean required)

Returns: CheckoutRuleTypeBuilder

Adds a free text configuration field that an administrator fills in when adding this rule to a shopping cart.

ParameterDescription
ididentifier of the field, which is also the key its value is stored under
textlabel shown next to the field
requiredtrue if the administrator must supply a value

addSelectField(String id, String text, boolean required, List<String> options)

Returns: CheckoutRuleTypeBuilder

Adds a drop down configuration field with a fixed list of options that an administrator chooses from when adding this rule.

ParameterDescription
ididentifier of the field, which is also the key its value is stored under
textlabel shown next to the field
requiredtrue if the administrator must supply a value
optionsthe values offered in the drop down

build()

Returns: void

Creates the checkout rule type from the configured values and registers it against this app. Does nothing if the app's engine has already finished initialising.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.