Magento 2 EE – Get Reward Points used on an Order
Migrating some older Magento1 EE code to Magento2, we came upon an issue where we could not figure out how to retrieve the Rewards Points that were used on an order by a customer.
Thankfully, we took a change and debugged the Quote object for the order, and found exactly what we needed. Below is a snippet of code on how you can programmatically retrieve the amount of Reward Points used in a Magento 2 order. Hopefully this will save some other developers time.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $quoteFactory = $objectManager->create('\Magento\Quote\Model\QuoteFactory'); $q = $quoteFactory->create()->load($quoteId); print "USED: ".$q->getRewardCurrencyAmount(); |