public function getAppliedCouponCode()
First, pass the RuleRepositoryInterface into your class constructor. magento 2 get coupon code programmatically
<?php if ($block->isCouponApplied()): ?> <div class="applied-coupon"> <strong>Coupon Applied:</strong> <?= $block->escapeHtml($block->getAppliedCouponCode()) ?> </div> <?php endif; ?> public function getAppliedCouponCode() First
public function __construct( CouponRepositoryInterface $couponRepository ) $this->couponRepository = $couponRepository; ?php if ($block->