Closed
Description
When placing an order using coupon code for shipping discount (provided via cart price rules) usage counter doesn't get updated.
Preconditions
- Magento 2.1.0
- Cart Price Rule applicable to some (any) cart
2.1. Use specific coupon, any coupon code
2.2. Actions providing only shipping discount
2.3. Uses per coupon \ customer set to some value > 0
Steps to reproduce
- Add some product to cart,
- Checkout using coupon code from the rule you've created
Expected result
- Coupon usage counter increments
Actual result
- Coupon usage counter doesn't increment
Clue
Since 2.1.0 there is extra condition in
Magento\SalesRule\Observer\SalesOrderAfterPlaceObserver : 60
if (!$order || $order->getDiscountAmount() == 0) {
return $this;
}
Which in previous versions was simpler: if (!$order)
When a rule provide only a shipping discount, getDiscountAmount() returns 0, and the script execution ends.
Proposed variant is the following:
if (!$order || !$order->getAppliedRuleIds()) {
return $this;
}
In such way script will continue execution, and usage counters will get updated.
Please consider implementing this fix in the upcoming patches.
Metadata
Metadata
Assignees
Labels
No labels