I need to get the details of an already created discount rule in magento 2.
I am using this code but don't work
public function __construct(
\Magento\SalesRule\Model\Coupon $coupon
)
{
$this->coupon = $coupon;
parent::__construct($context);
}
...
public function getDiscount($couponCode)
{
$ruleId = $this->coupon->loadByCode($couponCode)->getRuleId();
return $ruleId;
}