Skip to content

Commit 22e8f97

Browse files
author
Sergii Kovalenko
committed
MAGETWO-63403: Auto Generated coupon codes not applying
1 parent ec92cc2 commit 22e8f97

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

app/code/Magento/SalesRule/Model/ResourceModel/Rule/Collection.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,19 @@ public function setValidationFilter(
156156
\Magento\SalesRule\Model\Rule::COUPON_TYPE_NO_COUPON
157157
);
158158

159-
$orWhereConditions = [
159+
$autoGeneratedCouponCondition = [
160160
$connection->quoteInto(
161-
'(main_table.coupon_type = ? AND rule_coupons.type = 1)',
161+
"main_table.coupon_type = ?",
162162
\Magento\SalesRule\Model\Rule::COUPON_TYPE_AUTO
163163
),
164+
$connection->quoteInto(
165+
"rule_coupons.type = ?",
166+
\Magento\SalesRule\Api\Data\CouponInterface::TYPE_GENERATED
167+
),
168+
];
169+
170+
$orWhereConditions = [
171+
"(" . implode($autoGeneratedCouponCondition, " AND ") . ")",
164172
$connection->quoteInto(
165173
'(main_table.coupon_type = ? AND main_table.use_auto_generation = 1 AND rule_coupons.type = 1)',
166174
\Magento\SalesRule\Model\Rule::COUPON_TYPE_SPECIFIC

0 commit comments

Comments
 (0)