Question

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'
]
...

enter image description here

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!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top