Skip to content

CouponManagement Plugin not working on cart page

I have created a plugin to add custom functionaly before Coupon apply it’s working fine on checkout page but not working on cart page:
/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoQuoteModelCouponManagement">
        <plugin name="checkout_coupon_apply" type="GeekayRewardpointPluginCheckoutCouponApply"/>
    </type>

/Plugin/CheckoutCouponApply.php

<?php 
    
    namespace GeekayRewardpointPlugin;
    use MagentoFrameworkExceptionNoSuchEntityException;
    class CheckoutCouponApply {
    
            protected  $_customerSession;
            protected  $_cart;       
            protected  $_rewardHelper;
            protected  $_jsonFactory;
            protected  $_rule;
            protected  $_storeManager;
            protected  $_coupon;
            protected $logger;
            public function __construct(       
                MagentoCustomerModelSession $customerSession,
                MagentoCheckoutModelCart $cart,
                GeekayRewardpointHelperData $asplHelper,
                MagentoFrameworkControllerResultJsonFactory $jsonFactory,
                MagentoSalesRuleModelRule $rule,
                MagentoSalesRuleModelCoupon $coupon,
                MagentoStoreModelStoreManagerInterface $storeManager,
                PsrLogLoggerInterface $logger
            ) {            
                $this->_customerSession = $customerSession;       
                $this->_cart = $cart;                
                $this->_rewardHelper = $asplHelper;
                $this->_jsonFactory = $jsonFactory;
                $this->_storeManager = $storeManager;
                $this->_rule = $rule;
                $this->_coupon = $coupon;
                $this->logger = $logger;
    
            }
        public function beforeSet(MagentoQuoteModelCouponManagement $subject, $cartId, $couponCode)
        { 
    // code here
    }
    }

What’s wrong here?