Skip to content

Error in Applying Discount Comes in Core of Magento #1776

@aishwaryacedcoss

Description

@aishwaryacedcoss

I have created a coupon programmatically and when I have applied that coupon in discount it is giving the Error in core as:-
"Fatal error: Cannot use assign-op operators with overloaded objects nor string offsets in /opt/lampp/htdocs/workspace/magento_2_Aug/magento2/app/code/Magento/SalesRule/Model/Rule/Action/Discount/CartFixed.php on line 70"
$cartRules[$rule->getId()] -= $baseDiscountAmount;

Solution:-When I have changed the code to :-
$cartRules[$rule->getId()] = $cartRules[$rule->getId()]-$baseDiscountAmount;
It works.
Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions