1

I want to get the uid of billing address's street address at checkout page. I got the name of the field but getting the error when trying to get the uid of the field. For getting the name i used the following code:

 uiRegistry.get('checkout.steps.billing-step.payment.payments-list.checkmo-form.form-fields.street.0').name;

The same way i tried for uid:

uiRegistry.get('checkout.steps.billing-step.payment.payments-list.checkmo-form.form-fields.street.0').uid;

But getting this error: https://i.sstatic.net/9ks7M.png

Also i try this:

uiRegistry.get('checkout.steps.billing-step.payment.payments-list.checkmo-form.form-fields.street').elems()[0].uid;

But getting this error: https://i.sstatic.net/GkGfF.png

Any suggestion to get the uid of billing address's street address at checkout page.

1 Answer 1

1

You can use next option:

require('uiRegistry').filter('dataScope = billingAddress' + require('Magento_Checkout/js/model/quote').paymentMethod().method + '.street.0')[0].uid

or:

let selectedPaymentMethod = require('Magento_Checkout/js/model/quote').paymentMethod().method;
require('uiRegistry').get('dataScope = billingAddress' + selectedPaymentMethod + '.street.0').uid

Anyway, in order to get the current billing address field, you must know the selected payment method code.

example from console

Here are examples when the payment method has been changed (id changing for any new payment method selected):

id changing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.