Following the guide here: http://devdocs.magento.com/guides/v2.1/howdoi/checkout/checkout_edit_form.html

I can successfully update the template for input fields, but this same method doesn't seem to work for the 'street' customer attribute when the type is 'Multiple Line'. Has anyone else come up against this?

Here is what I have:

   <referenceBlock name="checkout.root">
          <argument name="jsLayout" xsi:type="array">
              <item name="components" xsi:type="array">
                  <item name="checkout" xsi:type="array">
                      <item name="children" xsi:type="array">
                          <item name="steps" xsi:type="array">
                              <item name="children" xsi:type="array">
                                  <item name="shipping-step" xsi:type="array">
                                      <item name="children" xsi:type="array">
                                          <item name="shippingAddress" xsi:type="array">
                                              <item name="children" xsi:type="array">
                                                  <!-- The name of the form the field belongs to -->
                                                  <item name="shipping-address-fieldset" xsi:type="array">
                                                      <item name="children" xsi:type="array">
                                                          <!-- the field you are customizing -->
                                                          <item name="street" xsi:type="array">
                                                              <item name="config" xsi:type="array">
                                                                  <!-- Assigning a new template -->
                                                                  <item name="elementTmpl" xsi:type="string">[Vendor_Name]/form/element/street.html</item>

Like I said, i'm just trying to apply the same concept that works for other attributes to the multiple line attribute. Thanks!

As noted in the comment, it looks like you have to modify the layoutProcessor to edit the children of street. Maybe there is a better way to do this?

However, when attempting to add a custom validation rule to these fields it doesn't seem to recognize my rule. Here is that validation:

], function(jQuery) {
    "use strict";

        'validate-not-po-box': [
            function(value, element, params) {
                // todo validate not PO box!
                alert('value is ' + value);
                // return false;
            'Address must not be a PO Box. Please supply a valid address.'
}, function (i, rule) {
       jQuery.validator.addMethod.apply(jQuery.validator, rule);

I'm including it this way:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
     <link src="[Vendore_Name]::js/additional-validation.js" />
  • Rafael's answer here worked for me to update the children of street and change the template. The comment indicates that you can add validation, which worked for required, but not my custom validation type. Updated question with more information. magento.stackexchange.com/questions/113797/… – Paul Briscoe Dec 20 '16 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.