Answers.Body: <p>You can make address fields required in two ways - at the front end using your own js form validation or html techniques (and note that the Commerce example templates are not at all intended  for use with live stores, they're just examples to get you going with your own development).</p>
  
  <p>The second approach is in a plugin -</p>
  
  <p><a href="https://craftcms.stackexchange.com/questions/15897/craft-commerce-validation-on-address-fields">Craft Commerce: Validation on Address Fields</a></p>
  
  <p>...the ideal approach is probably to use both methods.</p>
  
  <p>Currently (Dec 16) there isn't another way.  I presume this is to give maximum flexibility with checkout and perhaps (and hopefully) pending the time when addresses become proper element types with custom field support.  That would be nice.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-19T02:52:09.420Z
Answers.Text: Thank you for your answer. We've been using Craft for a while, but this is our first time in commerce. I wonder if Mijingo has some courses. :)
Answers.UserDisplayName: Dustin C
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-19T03:55:02.020Z
Answers.Text: Yep - https://mijingo.com/products/screencasts/craft-commerce/
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-18T00:06:23.273Z
Answers.LastActivityDate: 2016-12-18T00:06:23.273Z
Answers.LastEditDate: 2017-04-13T12:51:00.303Z
Answers.UserDisplayName: Jeremy Daalder
Answers.Body: <p>For those using Craft Commerce 2, additional address validation rules can be added by using to the <code>Address::EVENT_REGISTER_ADDRESS_VALIDATION_RULES</code> event.</p>
  
  <pre class="lang-php prettyprint-override"><code>use craft\commerce\events\RegisterAddressRulesEvent;
  use craft\commerce\models\Address;
  use yii\base\Event;
  
  Event::on(
      Address::class,
      Address::EVENT_REGISTER_ADDRESS_VALIDATION_RULES,
      function (RegisterAddressRulesEvent $event) {
          $event-&gt;rules[] = [['attention'], 'required'];
      }
  );
  </code></pre>
  
  <p>Source: <a href="https://docs.craftcms.com/commerce/v2/events.html#other-events" rel="nofollow noreferrer">https://docs.craftcms.com/commerce/v2/events.html#other-events</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-09T20:02:55.693Z
Answers.LastActivityDate: 2019-03-05T07:56:43.120Z
Answers.LastEditDate: 2019-03-05T07:56:43.120Z
Answers.UserDisplayName: Maarten de Graaf
Body: <p>I need to make the address fields in craft commerce required, as well as the phone number, etc. I tried to add the 'required' tag to the input element, but it breaks the form so you can't submit it -- at least in chrome. The submit button just stops working.</p>
  
  <p>Is there any way to make these fields required without a plugin? Seems that this should be a feature included (or something optionally set in the code).</p>
  
  <p>Thanks!</p>
  
Tags: <plugin-craftcommerce>
Title: Craft Commerce Required Address fields
ThreadText: # Craft Commerce Required Address fields
  
  (Asked by: username_0 on 2016-12-17)
  
  I need to make the address fields in craft commerce required, as well as the phone number, etc. I tried to add the 'required' tag to the input element, but it breaks the form so you can't submit it -- at least in chrome. The submit button just stops working.
  
  Is there any way to make these fields required without a plugin? Seems that this should be a feature included (or something optionally set in the code).
  
  Thanks!
  
  **Tags:** plugin-craftcommerce
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-12-18. Score: 3 | Accepted answer
  
  You can make address fields required in two ways - at the front end using your own js form validation or html techniques (and note that the Commerce example templates are not at all intended for use with live stores, they're just examples to get you going with your own development).
  
  The second approach is in a plugin -
  
  [Craft Commerce: Validation on Address Fields](https://craftcms.stackexchange.com/questions/15897/craft-commerce-validation-on-address-fields)
  
  ...the ideal approach is probably to use both methods.
  
  Currently (Dec 16) there isn't another way. I presume this is to give maximum flexibility with checkout and perhaps (and hopefully) pending the time when addresses become proper element types with custom field support. That would be nice.
  
  > **Comments:**
  > **username_0**: Thank you for your answer. We've been using Craft for a while, but this is our first time in commerce. I wonder if Mijingo has some courses. :)  
  > **username_1**: Yep - https://mijingo.com/products/screencasts/craft-commerce/  
  
  ---
  
  ### Answer by username_2 on 2019-02-09. Score: 3
  
  For those using Craft Commerce 2, additional address validation rules can be added by using to the `Address::EVENT_REGISTER_ADDRESS_VALIDATION_RULES` event.
  
  ```php
  use craft\commerce\events\RegisterAddressRulesEvent;
  use craft\commerce\models\Address;
  use yii\base\Event;
  
  Event::on(
      Address::class,
      Address::EVENT_REGISTER_ADDRESS_VALIDATION_RULES,
      function (RegisterAddressRulesEvent $event) {
          $event->rules[] = [['attention'], 'required'];
      }
  );
  
  ```
  
  Source: <https://docs.craftcms.com/commerce/v2/events.html#other-events>
  
  
  ---
  
  