Requiring Kit Item Before Submitting Enrollment Application

Admin: eCommerce Admin
Page: Advanced Customization > Javascript Insertion
URL: {client_ID}

With this example, you can restrict an Associate from submitting their enrollment application if they haven't added a kit to the cart.


Adding an Insertion

  1. In the JavaScript Insertions page, click + ADD INSERTION.
  2. Select Custom Script from the Insertion Type menu.
  3. Enter a sort Name.
  4. In the JavaScript Code Editor, paste the following code:
try {
  console.log('loaded custom insertions');
  var ct = window.customTriggers;
  var itemsService = angular.element(document).injector().get('itemsService');
  var userService = angular.element(document).injector().get('userService');
  var isDisabled = function (items, cartID, CurrentItem, Quantity, QuantityLimit, isPlaceOrder) {
    if (isPlaceOrder) {//on place order check
      //if only one pack is required(submit button disabled)
      if(userService.customerTypeID==1 && itemsService.selectedPacks.length == 0){        
        return true;
        return false;
  //show required message and item limit exceed message
  var tooltip = function (items, cartID, CurrentItem) {
    return ((userService.customerTypeID==1 && itemsService.selectedPacks.length == 0)? "One Kit Item is required":'');

catch (e) {
  console.log('Order Quantity Maximum Limit -- Insertion', e);