Magento 2 Get RMA By ID Programatically

July 20th, 2021

Since using RMA’s in Magento 2 is an Enterprise-only feature, there is not much information out there on what classes to use.

Below is how to programmatically load an RMA by ID in Magento 2:

     * RMA Helper 
     * -- 
     * Created by Joey Babcock July 2020 
     * Last modified by Joey Babcock July 2020 
    namespace Joeybab3\RMA\Helper;
    class RMA extends \Magento\Framework\App\Helper\AbstractHelper 
        protected $_rmaRepository; 
        public function __construct( \Magento\Rma\Api\RmaRepositoryInterface $rmaRepository ) 
            $this->_rmaRepository = $rmaRepository;
        public function getRmaById($rmaid)
            $rma = $this->_rmaRepository->get($rmaid);
            return $rma;

As you can see it’s not really that complicated but due to the lack of information I figured it might be nice to have more resources on it.


Leave a Reply

Your email address will not be published. Required fields are marked *