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

Wrong coupon usage handling for cart price rules with shipping discount #6693

Closed
alexnos88 opened this issue Sep 21, 2016 · 3 comments
Closed

Comments

@alexnos88
Copy link

alexnos88 commented Sep 21, 2016

When placing an order using coupon code for shipping discount (provided via cart price rules) usage counter doesn't get updated.

Preconditions

  1. Magento 2.1.0
  2. 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

  1. Add some product to cart,
  2. Checkout using coupon code from the rule you've created

Expected result

  1. Coupon usage counter increments

Actual result

  1. 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.

@danslo
Copy link
Contributor

danslo commented Sep 21, 2016

Duplicate of #5450.

@danslo
Copy link
Contributor

danslo commented Sep 21, 2016

Actually, also duplicate of #5171 and #3506.

@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 19, 2021
[Sidecar] MQE-2538: Create automated test for: "User uses pagination to navigate through the images in Standalone Media Gallery"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants