I have created custom component in checkout, and I want to get inside its js file list of active shipping methods and preselect one of them, according to configuration passed via custom
My component is placed in
shipping step node children array.
Problem is getting shipping method list. Firstly I tried to use as dependency
magento2/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-service.js and then use method
getShippingRates, which actually is used inside
magento2/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js and there it returns shipping methods list. Unfortunately, my js it returns an empty array.
Also, I tried to move my component into children array of
shipping adrress node, but it did not help.
In both places, my component js is loaded before
shipping.js and returns empty methods array. Has anyone tried to work with shipping methods during checkout loading?