How to Create ship to date field in the checkout payment page and disable the date for previous dates.

Created the shipping date field and added the date picker.

And disabled three days from the date they are ordering and also the previous dates (as we cannot have it ready by then).

By using the following code in the extension.

.extend(OrderWizardModulePaymentMethodPurchaseNumber.prototype, {
template: jj_shipping_date_shippingdate_tpl,

getContext: _.wrap(OrderWizardModulePaymentMethodPurchaseNumber.prototype.getContext, function(fn) {

var context = fn.apply(this, _.toArray(arguments).slice(1));
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');
var yyyy = today.getFullYear();

today = yyyy + '-' + mm + '-' + (parseInt(dd) + 3)
console.log('date', today);
context.startDate = today

return context;
})
});

Leave a comment

Your email address will not be published. Required fields are marked *