0

how to show custom order attribute in the checkout after shipping methods and admin as well? I am trying below code but it is not working. It also saves on the database. (in the database column already created in sales_order,sales_order_grid table)

checkout_index_index.xml

<item name="shippingAddress" xsi:type="array">
     <item name="children" xsi:type="array">
       <item name="shippingAdditional" xsi:type="array">
           <item name="component" xsi:type="string">uiComponent</item>
               <item name="displayArea" xsi:type="string">shippingAdditional</item>
               <item name="children" xsi:type="array">
                <item name="carrier_custom" xsi:type="array">
                 <item name="component" xsi:type="string">Module_Customcheckout/js/view/checkout/carrier_custom</item>
                   </item>
               </item>
             </item>
          </item>
      </item>

carrier_custom.js

define([
    'jquery',
    'ko',
    'uiComponent',
    'Magento_Checkout/js/model/quote'
], function ($, ko, Component, quote) {
    'use strict';

    return Component.extend({
        defaults: {
            template: 'Module_Customcheckout/checkout/carrier_custom'
        },

        initObservable: function () {

            this.selectedMethod = ko.computed(function() {
                var method = quote.shippingMethod();

                /* var selectedMethod = method != null ? method.carrier_code + '_' + method.method_code : null;
                return selectedMethod;*/
            }, this);

            return this;
        },
    });
});

carrier_custom.html

<li id="order_for_id">
    <label>Order For</label>
    <input type="text" name="order_for">
</li>

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.