Magento 2 custom checkout select field shippingAdditional add or remove require-entry upon selected shipping method
-
14-04-2021 - |
Вопрос
If Free Shipping Method is selected change validation E.G:'validation' => ['required-entry' => false],
...
'custom_field' => [
'component' => 'Vendor_Module/js/custom-field-component',
'config' => [
'customScope' => 'shippingAddress.custom_attributes',
'template' => 'ui/form/field',
'elementTmpl' => 'Vendor_Module/fields/select',
'options' => $this->getOptions(),
'id' => 'custom_field'
],
'dataScope' => 'custom_scope.custom_field',
'label' => 'Select Option',
'provider' => 'checkoutProvider',
'visible' => true,
'validation' => ['required-entry' => true],
'sortOrder' => 20,
'id' => 'custom_field'
]
...
I have added a mixin for select shipping method :
define([
'jquery'
], function ($) {
'use strict';
return function (target) {
return function (shippingMethod) {
//Add Remove Validation Logic Goes Here.
// call original method
target(shippingMethod);
};
}
});
Any ideas how to achieve this? Thanks!
Нет правильного решения
Не связан с magento.stackexchange