Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coupon not marked as used when used to apply free shipping #5450

Closed
danslo opened this issue Jul 4, 2016 · 3 comments
Closed

Coupon not marked as used when used to apply free shipping #5450

danslo opened this issue Jul 4, 2016 · 3 comments
Assignees
Labels
bug report Component: Tax Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@danslo
Copy link
Contributor

danslo commented Jul 4, 2016

Steps to reproduce

  1. Install Magento from develop branch.
  2. Go to Marketing > Cart Price Rules
  3. Create a new rule with a Coupon
  4. Set Uses per Coupon to '1'.
  5. Enable 'Use Auto Generation'.
  6. Under 'Actions', enable free shipping.
  7. Go through normal checkout process and submit an order.

Expected result

  1. The coupon code is marked as used.
  2. The number of times used is increased.

## Actual result 1. Used is "No" 2. Times used is "0".

This bug also exists in Magento 1.9.2.4.

@danslo
Copy link
Contributor Author

danslo commented Jul 5, 2016

The reason for this is the following part of SalesRule observer:

diff --git app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php
index e352ede..c102cd0 100644
--- app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php
+++ app/code/Magento/SalesRule/Observer/SalesOrderAfterPlaceObserver.php
@@ -57,7 +57,7 @@ class SalesOrderAfterPlaceObserver implements ObserverInterface
     {
         $order = $observer->getEvent()->getOrder();

-        if (!$order || $order->getDiscountAmount() == 0) {
+        if (!$order) {
             return $this;
         }

In my view, an applied coupon code is used, regardless of whether or not a discount was placed on the main order, since it can apply to other things (like free shipping). Is there a specific reason for checking discount amount?

@tkacheva tkacheva self-assigned this Jul 14, 2016
@tkacheva
Copy link

@danslo thanks for reporting the issue.

MAGETWO-55396

@pboisvert
Copy link

thanks @danslo for spotting the duplicates closing as a duplicate of #3506

magento-engcom-team pushed a commit that referenced this issue Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Tax Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

5 participants