Helpcenter +918010117117 https://cdn.storehippo.com/s/573db3149f0d58741f0cc63b/ms.settings/5256837ccc4abf1d39000001/57614ef64256dc6851749879-480x480.png" [email protected] https://www.facebook.com/StoreHippohttps://twitter.com/StoreHippohttps://www.linkedin.com/company/hippoinnovations/https://plus.google.com/+Storehippo/posts
B4,309-10 Spaze iTech Park, Sector 49, Sohna Road, 122001 Gurgaon India
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_time.
  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 =  new Date(parseInt(window.serverTimestamp));
        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('-');
        }
        var d=new Date();
        $scope.n = d.getHours();
        console.log('===time=====',$scope.n);
        $rootScope.getDateValue = function(opt){        if(!opt) return;
            $scope.selected_date = formatDate(opt);
            $scope.today_date = formatDate($scope.today_date);
            if ($scope.today_date != $scope.selected_date) {
                $scope.n = 0;
            }
            else $scope.n = d.getHours();
            $scope.optionData[$scope.option.name].value = '';
            console.log('==opt==',$scope.selected_date , $scope.today_date,  $scope.n)
        }
    }
    
  14. Click on Save to save the widget.
2022-03-29T12:48:30.838Z