Solution: Discount Based on Payment Method Not Showing in Magento 2 Cart Total

Solution: Discount Based on Payment Method Not Showing in Magento 2 Cart Total

Offering discounts may seem to be a concern for the profit of the business. But, implementing it effectively leads to brand recognization, attract new customers and win customer loyalty.

“Employed thoughtfully, discounts can give sales a healthy boost; handled incorrectly, they can devalue and detract from the bottom line.”

Talking about the discounts, it is important that customers acknowledge that they are offered the discount! However, for Magento 2 stores, there is sometimes an issue of discount based on payment method not showing in Magento 2 cart total!

If the order summary does not reflect the discount calculation in the cart, how are you ever going to leverage the benefits of discounts?

The discount is applied but does not show in the cart. It may lead to the confusion for the customer as to whether he benefitted from using a particular payment method or not? Such confusions result in an abandoned cart. Surely, we don’t want that and hence implement the solution given below!

Also, you can download package of the below solution directly from GitHub.

Solution: Discount Based on Payment Method Not Showing in Magento 2 Cart Total

  1. Create registration.php file at app\code\Meetanshi\Fixpaymentrule directory

  2. Create module.xml at app\code\Meetanshi\Fixpaymentrule\etc directory

  3. Create routes.xml at app\code\Meetanshi\Fixpaymentrule\etc\frontend directory

  4. Create ApplyPaymentMethod.php at app\code\Meetanshi\Fixpaymentrule\Controller\Checkout directory

  5. Create requirejs-config.js at app\code\Meetanshi\Fixpaymentrule\view\frontend directory
  6. Create select-payment-method.js at app\code\Meetanshi\Fixpaymentrule\view\frontend\web\js\action directory

That’s it.

With the above solution, if you offer a payment method based discount, it will always show the calculations clearly in the cart total, leaving no room for any confusions!

Hope it helps! If you face any doubts in the method, feel free to mention them in the Comments section below and I’d be happy to help.

Thank you.

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

5
(based on 24 Reviews)

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

14 comments On Solution: Discount Based on Payment Method Not Showing in Magento 2 Cart Total

Leave a reply:

Your email address will not be published.