Answers.Body: <p>According to Luke, this is the preferred method for Commerce 3.</p>
  
  <p>In a custom module or plugin:</p>
  
  <pre><code>Event::on(\craft\commerce\models\Address::class, \craft\base\Model::EVENT_DEFINE_RULES, static function(\craft\events\DefineRulesEvent $event) {
      $rules = $event-&gt;rules;
      $rules[] = [['firstName','lastName'], 'required'];
      $event-&gt;rules = $rules;
  });
  </code></pre>
  
  <p>Some more details about what kind of rules you can add here, if you want something more complex than a list of required fields:
  <a href="https://www.yiiframework.com/doc/guide/2.0/en/tutorial-core-validators" rel="nofollow noreferrer">https://www.yiiframework.com/doc/guide/2.0/en/tutorial-core-validators</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-06T18:43:35.963Z
Answers.Text: thanks @Gterrill
Answers.UserDisplayName: Luke Holder
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-06T18:25:37.523Z
Answers.LastActivityDate: 2020-02-06T18:25:37.523Z
Answers.UserDisplayName: GTerrill
Body: <p>Was wondering how to do this in Commerce 3 as there were a few different older methods discussed here.</p>
  
Tags: <plugin-craftcommerce><validation><plugin-craftcommerce3>
Title: Server-side address validation in Craft Commerce 3
ThreadText: # Server-side address validation in Craft Commerce 3
  
  (Asked by: username_0 on 2020-02-06)
  
  Was wondering how to do this in Commerce 3 as there were a few different older methods discussed here.
  
  **Tags:** plugin-craftcommerce, validation, plugin-craftcommerce3
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-02-06. Score: 2
  
  According to username_1, this is the preferred method for Commerce 3.
  
  In a custom module or plugin:
  
  ```
  Event::on(\craft\commerce\models\Address::class, \craft\base\Model::EVENT_DEFINE_RULES, static function(\craft\events\DefineRulesEvent $event) {
      $rules = $event->rules;
      $rules[] = [['firstName','lastName'], 'required'];
      $event->rules = $rules;
  });
  
  ```
  
  Some more details about what kind of rules you can add here, if you want something more complex than a list of required fields:
  <https://www.yiiframework.com/doc/guide/2.0/en/tutorial-core-validators>
  
  > **Comments:**
  > **username_1**: thanks @username_0  
  
  ---
  
  