Craft Commerce: Validation on Address Fields Can someone break down how I should validate empty address fields as a plugin for Craft Commerce and take the following answer further?

The Craft Commerce documentation provides the following example for the name field - but I'm not sure what my next steps should be...

public function init()
{
    craft()-&gt;on('commerce_addresses.onBeforeSaveAddress', function($event){
            $address = $event-&gt;params['address'];
            $address-&gt;addError('firstName','Not a cool name man.');
            $event-&gt;performAction = false;
    });
}
In Craft3 you can do it like this:

use Craft;
use craft\base\Plugin;
use craft\commerce\models\Address;
use yii\base\Event;

class Custom extends Plugin
{
    public function init()
    {
        parent::init();

        Event::on(Address::class, Address::EVENT_BEFORE_VALIDATE, function (Event $event) {
            $address = $event-&gt;sender;
            if (empty($address-&gt;address1)) {
                $address-&gt;addError('address1', Craft::t('app', 'Address Line 1 is required'));
                $event-&gt;handled = true; // stop other handlers for this event
            }
        });
    }
}