<img src="abc.png" />
    
call to replace anchor tags contains '/admin' in href

How to add delivery time option on checkout?

Scenario

You want to add a delivery time option on the checkout so that your customers can select a time for delivery.

Example

Steps

To add a delivery time option at checkout, you can enable time option on the checkout. For providing calendar on the checkout page, you need to add calendar widget. To do so, you are required Order Option form and then add the calendar widget to your store. Follow the below-mentioned steps:

Creating Order Option form

  1. Go to Site  Forms section in StoreHippo Admin Panel.
  2. Click on Add new to create the Order option form.
  3. Provide the name of the form as 'order_option'.
  4. In the order options form, create a field for delivery date.
  5. Enter label as 'Select Delivery Time' and name as 'select_delivery_time'.
  6. Select type as Widget.
  7. Click on the field settings icon next to type to edit the field. In the Widget field, enter the name of the widget (say "Calendar").
  8. Add options with the name as the delivery time slot (say 11 AM to 1 PM), in the value enter the lower time and the upper time limit separated by "-" (Say, 10-12).
  9. Click on Save to save the form.

    Adding Widget

  10. Go to StoreHippo Design Theme.
  11. Go to HTML section and click on Show all widgets.
  12. Click on Add new widget.
  13. Add new store widget, name it as "calendar" (mentioned above), add the below-mentioned code:

    Template:
    <select class="form-control" ng-model="optionData[option.name].value">
        <option value="">Please Select</option>
        <option ng-if="opt.value" ng-disabled="n >= opt.value.split('-')[0] && today_date==selected_date"
                ng-repeat="opt in option.settings.options" value="{{opt.value}}">{{opt.name}}
        </option>
        <option ng-if="!opt.value" ng-repeat="opt in option.options" value="{{opt.value}}">{{opt.name}}
        </option>
    </select>
    

    Controller:

    function($scope,$rootScope){
    
        $scope.today_date = $rootScope.today;
    
        var formatDate = function (date) {
            var d = new Date(date),
                month = '' + (d.getMonth() + 1),
                day = '' + d.getDate(),
                year = d.getFullYear();
            if (month.length < 2) month = '0' + month;
            if (day.length < 2) day = '0' + day;
            return [year, month, day].join('-');
        }
    
        $rootScope.getDateValue = function(opt){
            console.log('====opt',opt);
            $scope.selected_date = formatDate(opt);
            console.log('===orderOptions opt=====',$scope.selected_date)
        }
    
        var d=new Date();
        $scope.n = d.getHours();
        console.log('===time=====',$scope.n)
    
    }
    
    
  14. Click on Save to save the widget.