Question

I have created my custom address attribute through my own module, it is shown on checkout page and admin, I also managed to insert it to customer address edit in account by overriding edit.phtml. Unfortunately, I struggle with adding value to the input so the current value is shown in the input. I found some solutions but they only work with customer attribute but not with the customer address attribute.

edit.phtml -this is my current code, it does not work, value is still empty

<?php

  $DIC = '';
    if($block->getCustomer()->getCustomAttribute('DIC')) {
      $DIC = $block->getCustomer()->getCustomAttribute('DIC')->getValue();
    }
?>
            <div class="field DIC">
               <label class="label" for="DIC">DIČ</label>
                <div class="control">
               <input type="text" value="<?= $DIC ?>" title="<?php /* @escapeNotVerified */ echo __('DIC') ?>" name="DIC"/>
               </div>
            </div>

My Magento version is 2.2.11 CE.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top