1

I am new in Magento. I am having a lot of problems to achieve each step in the learning curve. I needed to add a custom shipping method. I was fallowging this tutorial: https://www.mageplaza.com/devdocs/magento-2-create-shipping-method/ Is not working for me, maybe because multiple causes. But for example, I see the class Shipping is extending from "\Magento\Shipping\Model\Carrier\AbstractCarrier" but I don´t have this path in my Magento folder. I have Magento CE 2.1. That changes for each version? I am really confused, :(. Thank you very much

2 Answers 2

2

if you looking for path for Magento core modules, you could check on this folder :

<magento_root>/vendor/magento/*

especially for the module that you mention \Magento\Shipping\Model\Carrier\AbstractCarrier you could get that class file on this path<magento_root>/vendor/magento/module-shipping/model/carrier/AbstractCarrier.php

4
  • Great @mrfizh sounds good. Thanks for your answer. I realized now that this notation(a/b/c/d) is for namespacing nesting and not related with the file path. Commented Oct 10, 2018 at 15:58
  • you're welcome glad to help you. yes that right, magento 2 uses that notation as namespacing, you will get same case with 3rd plugin that installed from the composer
    – mrfizh
    Commented Oct 10, 2018 at 16:04
  • Hey @mrfizh sorry for bother you. I am receiving this error now, after follow steps of the tutorial. Any Ideas? (or do you have better tutorial to read to add custom shipping methos? I really need to add them dinamically). "Fatal error: Class Magento\Framework\Config\FileIterator contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Countable::se) in C:\xampp\htdocs\magento\vendor\magento\framework\Config\FileIterator.php" Commented Oct 10, 2018 at 16:12
  • 1
    hmm, I think it's better for you to create new question again, and post your code that already you wrote, it will make easy for me and other users to help you :)
    – mrfizh
    Commented Oct 10, 2018 at 16:18
3

When you extend any file ( which is in vendor/magento/module-x folder ) its path is always start with \Magento\X so in your case if you are extending file from module-shipping then its path would be \Magento\Shipping\.

so here you will see module is replaced with Magento and module name will be named with first letter capital i.e shipping will become Shipping.

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.