1

I want to remove required validation from street field in billing address.

I am using below code that remove the validation from telephone field but not remove required validation from street field:-

        <?php
namespace Teejan\CustomBillingaddress\Plugin;

class LayoutProcessor
{
    public function afterProcess($subject, $jsLayout)
    {
        foreach ($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']
                 ['payment']['children']['payments-list']['children'] as &$child)
        {
            $child['children']['form-fields']['children']['telephone']['validation'] = ['required-entry' => false];
            $child['children']['form-fields']['children']['street']['validation'] = ['required-entry' => false];
            unset($child['children']['form-fields']['children']['postcode']);
            //unset($child['children']['form-fields']['children']['street']);
        }

        return $jsLayout;
    }
}

Please help me to remove this.

I also try below format but no luck:-

$child['children']['form-fields']['children']['street["0"]']['validation'] = ['required-entry' => false];
3
  • 1
    Try this way: $child['children']['form-fields']['children']['street']['children'][0]['validation'] = []; May 15, 2020 at 15:54
  • 1
    Yes thanks, its working I am using $child['children']['form-fields']['children']['street']['children'][0]['validation'] = ['required-entry' => false]; May 15, 2020 at 16:30
  • @MattiaKozianowski it's works but getting validation error on next step when click on Place order button May 15, 2020 at 17:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.