да, это возможно, изменив в Magento_Checkout / js / model / shipping-save-processor / default.js
Я добавил поле, confirm email
которое должно быть таким же, как email
и это обязательное поле в кассе, вы можете настроить в соответствии с требованиями.
app\code\Ketan\Checkout\view\frontend\requirejs-config.js
var config = {
"map": {
"*": {
"Magento_Checkout/js/model/shipping-save-processor/default" : "Ketan_Checkout/js/shipping-save-processor"
}
}
}
продлить JS file app\code\Ketan\Checkout\view\frontend\web\js\shipping-save-processor.js
/*
* *
* @author DCKAP Team
* @copyright Copyright (c) 2018 DCKAP (https://www.dckap.com)
* @package Dckap_CustomFields
*/
define(
[
'ko',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/resource-url-manager',
'mage/storage',
'Magento_Checkout/js/model/payment-service',
'Magento_Checkout/js/model/payment/method-converter',
'Magento_Checkout/js/model/error-processor',
'Magento_Checkout/js/model/full-screen-loader',
'Magento_Checkout/js/action/select-billing-address',
'jquery'
],
function (
ko,
quote,
resourceUrlManager,
storage,
paymentService,
methodConverter,
errorProcessor,
fullScreenLoader,
selectBillingAddressAction,
$
) {
'use strict';
return {
saveShippingInformation: function () {
var payload;
var username = $("#customer-email").val();
var conformusername = $("#conformusername").val();
/*============ Customization Start =============*/
//if(quote.shippingMethod().method_code=='flaterate'){ // Check if flaterate is selected
if(conformusername != username){
$("#conformusername-error").show(); // show hidden message
$("#conformusername").focus(); // move cursor to the point
return false;
}
// }
/*============ Customization End =============*/
if (!quote.billingAddress()) {
selectBillingAddressAction(quote.shippingAddress());
}
payload = {
addressInformation: {
shipping_address: quote.shippingAddress(),
billing_address: quote.billingAddress(),
shipping_method_code: quote.shippingMethod().method_code,
shipping_carrier_code: quote.shippingMethod().carrier_code
}
};
fullScreenLoader.startLoader();
return storage.post(
resourceUrlManager.getUrlForSetShippingInformation(quote),
JSON.stringify(payload)
).done(
function (response) {
quote.setTotals(response.totals);
paymentService.setPaymentMethods(methodConverter(response.payment_methods));
fullScreenLoader.stopLoader();
}
).fail(
function (response) {
errorProcessor.process(response);
fullScreenLoader.stopLoader();
}
);
}
};
}
);