$quote = $quoteFactory->create()->load($quoteId); return $quote->getCouponCode();

class GetAllCouponCodes

// For logged-in customers if ($this->customerSession->isLoggedIn()) $customerId = $this->customerSession->getCustomerId(); $quote = $this->quoteRepository->getActiveForCustomer($customerId); else // For guest customers $quote = $this->checkoutSession->getQuote(); magento 2 get coupon code programmatically

return $result; Useful for generating a dropdown of all existing coupon codes in admin or API. $quote = $quoteFactory-&gt