What is the best way to save a custom field in shipping address?How to add new custom field to billing...

lead or lag function to get several values, not just the nth

Canadian citizen, on US no-fly list. What can I do in order to be allowed on flights which go through US airspace?

What is better: yes / no radio, or simple checkbox?

I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?

Starting index at zero

How to substitute values from a list into a function?

How can I handle a player who pre-plans arguments about my rulings on RAW?

How can I be pwned if I'm not registered on the compromised site?

Is the withholding of funding notice allowed?

What is this waxed root vegetable?

Should we avoid writing fiction about historical events without extensive research?

Get length of the longest sequence of numbers with the same sign

Can we carry rice to Japan?

If a set is open, does that imply that it has no boundary points?

How to evaluate the limit where something is raised to a power of x?

Why is it "take a leak?"

Where is the line between being obedient and getting bullied by a boss?

If nine coins are tossed, what is the probability that the number of heads is even?

How to make a *empty* field behaves like a *null* field when it comes to standard values?

Non-Italian European mafias in USA?

Pure Functions: Does "No Side Effects" Imply "Always Same Output, Given Same Input"?

When was drinking water recognized as crucial in marathon running?

Is there a full canon version of Tyrion's jackass/honeycomb joke?

How can atoms be electrically neutral when there is a difference in the positions of the charges?



What is the best way to save a custom field in shipping address?


How to add new custom field to billing address section in magento2Magento 2 - Save custom shipping address' fields to quote_address tableMagento 2 checkout - add a custom field between shipping address and shipping methodMagento2: Adding custom fields on checkout are not associated with the formMagento 2.2.0 - checkout_index_index.xml shippingAdditional not workingHow to auto fill the shipping address field in Checkout in Magento 2.2Moving payment to shipping step in Magento 2Magento2 Shipping address save override js fileWhat is the best way change the label of fields in Shipping Address during checkout?What is the best way to buy a Product individually













0















I have added a custom field on checkout in shipping address section using below code.



etc/frontend/di.xml



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCheckoutBlockCheckoutLayoutProcessor">
<plugin name="ProcessAddressConfiguration" type="VendorModuleBlockCheckoutPassportProcessor"/>
</type>
</config>


Block/Checkout/PassportProcessor.php



<?php
namespace VendorModuleBlockCheckout;

class PassportProcessor
{
public function afterProcess(MagentoCheckoutBlockCheckoutLayoutProcessor $processor, $jsLayout){

$passport_no = 'passport_no';

$newField = [
'component' => 'Magento_Ui/js/form/element/abstract',
'config' => [
'customScope' => 'shippingAddress.custom_attributes',
'customEntry' => null,
'template' => 'ui/form/field',
'elementTmpl' => 'ui/form/element/input',
'tooltip' => [
'description' => 'description'
]
],
'dataScope' => 'shippingAddress.custom_attributes.' . $passport_no,
'label' => 'Passport Number',
'provider' => 'checkoutProvider',
'sortOrder' => 0,
'validation' => [
'required-entry' => true
],
'options' => [],
'filterBy' => null,
'customEntry' => null,
'visible' => true
];

$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']['shippingAddress']['children']['shipping-address-fieldset']['children'][$passport_no] = $newField;

return $jsLayout;
}
}


Questions:




  • In which tables I should save it so that when I pull the order, passport_no should be available in shipping address section of that order?

  • How I can save passport_no in those tables from here?


I went through multiple posts but I do not see a complete list of steps which should be taken to achieve it.









share



























    0















    I have added a custom field on checkout in shipping address section using below code.



    etc/frontend/di.xml



    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoCheckoutBlockCheckoutLayoutProcessor">
    <plugin name="ProcessAddressConfiguration" type="VendorModuleBlockCheckoutPassportProcessor"/>
    </type>
    </config>


    Block/Checkout/PassportProcessor.php



    <?php
    namespace VendorModuleBlockCheckout;

    class PassportProcessor
    {
    public function afterProcess(MagentoCheckoutBlockCheckoutLayoutProcessor $processor, $jsLayout){

    $passport_no = 'passport_no';

    $newField = [
    'component' => 'Magento_Ui/js/form/element/abstract',
    'config' => [
    'customScope' => 'shippingAddress.custom_attributes',
    'customEntry' => null,
    'template' => 'ui/form/field',
    'elementTmpl' => 'ui/form/element/input',
    'tooltip' => [
    'description' => 'description'
    ]
    ],
    'dataScope' => 'shippingAddress.custom_attributes.' . $passport_no,
    'label' => 'Passport Number',
    'provider' => 'checkoutProvider',
    'sortOrder' => 0,
    'validation' => [
    'required-entry' => true
    ],
    'options' => [],
    'filterBy' => null,
    'customEntry' => null,
    'visible' => true
    ];

    $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']['shippingAddress']['children']['shipping-address-fieldset']['children'][$passport_no] = $newField;

    return $jsLayout;
    }
    }


    Questions:




    • In which tables I should save it so that when I pull the order, passport_no should be available in shipping address section of that order?

    • How I can save passport_no in those tables from here?


    I went through multiple posts but I do not see a complete list of steps which should be taken to achieve it.









    share

























      0












      0








      0








      I have added a custom field on checkout in shipping address section using below code.



      etc/frontend/di.xml



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
      <type name="MagentoCheckoutBlockCheckoutLayoutProcessor">
      <plugin name="ProcessAddressConfiguration" type="VendorModuleBlockCheckoutPassportProcessor"/>
      </type>
      </config>


      Block/Checkout/PassportProcessor.php



      <?php
      namespace VendorModuleBlockCheckout;

      class PassportProcessor
      {
      public function afterProcess(MagentoCheckoutBlockCheckoutLayoutProcessor $processor, $jsLayout){

      $passport_no = 'passport_no';

      $newField = [
      'component' => 'Magento_Ui/js/form/element/abstract',
      'config' => [
      'customScope' => 'shippingAddress.custom_attributes',
      'customEntry' => null,
      'template' => 'ui/form/field',
      'elementTmpl' => 'ui/form/element/input',
      'tooltip' => [
      'description' => 'description'
      ]
      ],
      'dataScope' => 'shippingAddress.custom_attributes.' . $passport_no,
      'label' => 'Passport Number',
      'provider' => 'checkoutProvider',
      'sortOrder' => 0,
      'validation' => [
      'required-entry' => true
      ],
      'options' => [],
      'filterBy' => null,
      'customEntry' => null,
      'visible' => true
      ];

      $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']['shippingAddress']['children']['shipping-address-fieldset']['children'][$passport_no] = $newField;

      return $jsLayout;
      }
      }


      Questions:




      • In which tables I should save it so that when I pull the order, passport_no should be available in shipping address section of that order?

      • How I can save passport_no in those tables from here?


      I went through multiple posts but I do not see a complete list of steps which should be taken to achieve it.









      share














      I have added a custom field on checkout in shipping address section using below code.



      etc/frontend/di.xml



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
      <type name="MagentoCheckoutBlockCheckoutLayoutProcessor">
      <plugin name="ProcessAddressConfiguration" type="VendorModuleBlockCheckoutPassportProcessor"/>
      </type>
      </config>


      Block/Checkout/PassportProcessor.php



      <?php
      namespace VendorModuleBlockCheckout;

      class PassportProcessor
      {
      public function afterProcess(MagentoCheckoutBlockCheckoutLayoutProcessor $processor, $jsLayout){

      $passport_no = 'passport_no';

      $newField = [
      'component' => 'Magento_Ui/js/form/element/abstract',
      'config' => [
      'customScope' => 'shippingAddress.custom_attributes',
      'customEntry' => null,
      'template' => 'ui/form/field',
      'elementTmpl' => 'ui/form/element/input',
      'tooltip' => [
      'description' => 'description'
      ]
      ],
      'dataScope' => 'shippingAddress.custom_attributes.' . $passport_no,
      'label' => 'Passport Number',
      'provider' => 'checkoutProvider',
      'sortOrder' => 0,
      'validation' => [
      'required-entry' => true
      ],
      'options' => [],
      'filterBy' => null,
      'customEntry' => null,
      'visible' => true
      ];

      $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']['shippingAddress']['children']['shipping-address-fieldset']['children'][$passport_no] = $newField;

      return $jsLayout;
      }
      }


      Questions:




      • In which tables I should save it so that when I pull the order, passport_no should be available in shipping address section of that order?

      • How I can save passport_no in those tables from here?


      I went through multiple posts but I do not see a complete list of steps which should be taken to achieve it.







      magento2 magento2.2 shipping-address best-practice





      share












      share










      share



      share










      asked 6 mins ago









      amitshreeamitshree

      3,165103781




      3,165103781






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f264615%2fwhat-is-the-best-way-to-save-a-custom-field-in-shipping-address%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f264615%2fwhat-is-the-best-way-to-save-a-custom-field-in-shipping-address%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          夢乃愛華...