Good afternoon everyone,

I have a question about the cart extension, I would like to modify the behavior of the “checkout” form.

I need the field: “label_address_2” to be mandatory, currently in the rules it is optional.

The file I want to modify is:
“extensions/igniter/cart/components/Checkout.php”

In the part:

protected function createRules()
        {
         ...
         if (Location::orderTypeIsDelivery()) {
             ...
             $namedRules[] = ['address.address_2', 'lang:igniter.cart::default.checkout.label_address_2', 'nullable|min:3|max:128'];
             ....
         }

        ...
     }

I’m interested in changing from ‘nullable’ to ‘required’.

How can I do it without directly editing the extension code in case it is updated in the future and the changes are overwritten.

In the administration panel I have not been able to see that this field can be modified to be optional or not.

I have thought that a solution could be to extend this extension but I am not sure how to do it.

Does anyone know how I could solve it?

Thanks!! 🙂

    4 days later

    gabrielcalle Extending the component is the way to go for now.

    In your custom extension
    Create your custom component that extends the Checkout
    Register your custom component
    Replace the attached component on the checkout page with your customcomponent