0

In Magento 2.3 EE, if a customer has reward points balance it is automatically applied to cart when the cart page is loaded and customer goes to the checkout process.

I want to remove this functionality and provide customers the choice to use reward points in the checkout process. For this I have made the "Use reward points" section visible on the checkout page. Now I only need to stop the reward points getting applied automatically to quote.

I tried removing the observers one by one but cannot find where exactly the reward points are applied to quote.

1 Answer 1

0

So the module is using an extension attribute in quote. The value in this extension attribute is used as a condition to recollect totals.

I created an observer on cart load and set the extension attribute to false.

Used the event controller_action_predispatch_checkout_cart_index

<?php

namespace Vendor\RewardsOverride\Observer;

use Magento\Framework\Event\ObserverInterface;
use Magento\Checkout\Model\Session as CheckoutSession;

class CartLoad implements ObserverInterface
{
    public function __construct(
        CheckoutSession $checkoutSession
    ) {
        $this->checkoutSession = $checkoutSession;
    }

    public function execute(\Magento\Framework\Event\Observer $observer) {
        $quote = $this->checkoutSession->getQuote();
        $quote->setUseRewardPoints(false)->save();
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.