Magento 2 Get Coupon Code Programmatically Link

private OrderRepositoryInterface $orderRepository;

public function __construct(CollectionFactory $couponCollectionFactory) magento 2 get coupon code programmatically

use Magento\Quote\Api\CartRepositoryInterface; use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Framework\Exception\NoSuchEntityException; private OrderRepositoryInterface $orderRepository

$result = []; foreach ($collection as $order) $result[$order->getId()] = $order->getCouponCode(); $result = []

Comments

Top