4

I have created admin form. I want to get shipping carrier list in admin form. How can get it? Like this below image.

enter image description here

Please give me proper suggestion.

1 Answer 1

2

You can simply use the \Magento\Shipping\Model\Config\Source\Allmethods.php class which provides a toOptionArray() method to provide the list of all shipping carriers.

Please note that you can give a parameter to this method that, if set to true, will return only the active shipping carriers.

3
  • Hello Raphael, Thanks for help. I got it, but now i use multiselect field for this field when i save this form i got error like this :- "Notice: Array to string conversion in /mage2/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 2915Something went wrong while saving the page." Please give me suggetion for this. Commented Aug 31, 2016 at 10:26
  • 1
    @PayalPatel feel free to create a new question and post your full code there. It's not convenient with the comments Commented Aug 31, 2016 at 10:27
  • Hello Raphael, Check my new question. Commented Aug 31, 2016 at 10:35

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.