{"action":"opened","issue":{"url":"https://api.github.com/repos/magento/magento2/issues/6693","repository_url":"https://api.github.com/repos/magento/magento2","labels_url":"https://api.github.com/repos/magento/magento2/issues/6693/labels{/name}","comments_url":"https://api.github.com/repos/magento/magento2/issues/6693/comments","events_url":"https://api.github.com/repos/magento/magento2/issues/6693/events","html_url":"https://github.com/magento/magento2/issues/6693","id":178302074,"number":6693,"title":"Wrong coupon usage handling for cart price rules with shipping discount","user":{"login":"alexnos88","id":1861989,"avatar_url":"https://avatars.githubusercontent.com/u/1861989?v=3","gravatar_id":"","url":"https://api.github.com/users/alexnos88","html_url":"https://github.com/alexnos88","followers_url":"https://api.github.com/users/alexnos88/followers","following_url":"https://api.github.com/users/alexnos88/following{/other_user}","gists_url":"https://api.github.com/users/alexnos88/gists{/gist_id}","starred_url":"https://api.github.com/users/alexnos88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexnos88/subscriptions","organizations_url":"https://api.github.com/users/alexnos88/orgs","repos_url":"https://api.github.com/users/alexnos88/repos","events_url":"https://api.github.com/users/alexnos88/events{/privacy}","received_events_url":"https://api.github.com/users/alexnos88/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-21T10:05:00Z","updated_at":"2016-09-21T10:05:00Z","closed_at":null,"body":"When placing an order using coupon code for shipping discount (provided via cart price rules) usage counter doesn't get updated.\r\n\r\n### Preconditions\r\n1. Magento 2.1.0\r\n2. Cart Price Rule applicable to some (any) cart\r\n2.1. Use specific coupon, any coupon code\r\n2.2. Actions providing only shipping discount\r\n2.3. Uses per coupon \\ customer set to some value > 0\r\n\r\n### Steps to reproduce\r\n1. Add some product to cart,\r\n2. Checkout using coupon code from the rule you've created\r\n\r\n### Expected result\r\n1. Coupon usage counter increments\r\n\r\n### Actual result\r\n1. Coupon usage counter doesn't increment\r\n\r\n\r\n### Clue\r\nSince 2.1.0 there is extra condition in\r\n\\vendor\\magento\\module-sales-rule\\Observer\\SalesOrderAfterPlaceObserver.php : 60\r\n`if (!$order || $order->getDiscountAmount() == 0)`\r\nWhich in previous versions was simpler `if (!$order)`\r\n\r\nWhen a rule provide only a shipping discount, getDiscountAmount() returns 0, and the script execution ends.\r\n\r\nProposed variant is the following:\r\n`if (!$order || !$order->getAppliedRuleIds())`\r\n\r\nIn such way script will continue execution, and usage counters will get updated.\r\n\r\nPlease consider implementing this fix in the upcoming patches."}}
{"actor":{"display_login":"alexnos88"}}