Magento 2: How to add custom discount in cart programmatically?
Refer to how Magento2 applies sales-rule discounts. I applied similar approach to apply custom discount, by creating following files in my module:
Namespace_Module\etc\sales.xml
Namespace_Module\Model\Quote\Discount.php
Namespace_Module\view\frontend\layout\checkout_cart_index.xml
Namespace_Module\view\frontend\layout\checkout_index_index.xml
If Fetch is not showing the custom discount description, it was a core magento bug, see this ticket for patch details: https://github.com/magento/magento2/issues/3594
Namespace_Module\etc\sales.xml
Namespace_Module\Model\Quote\Discount.php
Namespace_Module\view\frontend\layout\checkout_cart_index.xml
Namespace_Module\view\frontend\layout\checkout_index_index.xml
If Fetch is not showing the custom discount description, it was a core magento bug, see this ticket for patch details: https://github.com/magento/magento2/issues/3594
Comments
Post a Comment