Programmatically - Magento 2 Get Coupon Code
private OrderRepositoryInterface $orderRepository;
try $quote = $this->quoteRepository->get($quoteId); return $quote->getCouponCode(); catch (NoSuchEntityException $e) return null; magento 2 get coupon code programmatically
public function fromQuote(int $quoteId): ?string private OrderRepositoryInterface $orderRepository
If you need to know which coupon affected a specific cart item (useful for per‑item discount debugging). try $quote = $this->
