Skip to content

Commit ee296cc

Browse files
Robert Heisitnikov
authored andcommitted
MAGETWO-45339: Cart price rule not applied for Payment method conditions
- remove payment_method condition for cart rules
1 parent 674126d commit ee296cc

File tree

1 file changed

+10
-0
lines changed
  • app/code/Magento/SalesRule/Model/Rule/Condition

1 file changed

+10
-0
lines changed

app/code/Magento/SalesRule/Model/Rule/Condition/Address.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public function getInputType()
9999
return 'numeric';
100100

101101
case 'shipping_method':
102+
case 'payment_method':
102103
case 'country_id':
103104
case 'region_id':
104105
return 'select';
@@ -115,6 +116,7 @@ public function getValueElementType()
115116
{
116117
switch ($this->getAttribute()) {
117118
case 'shipping_method':
119+
case 'payment_method':
118120
case 'country_id':
119121
case 'region_id':
120122
return 'select';
@@ -143,6 +145,10 @@ public function getValueSelectOptions()
143145
$options = $this->_shippingAllmethods->toOptionArray();
144146
break;
145147

148+
case 'payment_method':
149+
$options = $this->_paymentAllmethods->toOptionArray();
150+
break;
151+
146152
default:
147153
$options = [];
148154
}
@@ -168,6 +174,10 @@ public function validate(\Magento\Framework\Model\AbstractModel $model)
168174
}
169175
}
170176

177+
if ('payment_method' == $this->getAttribute() && !$address->hasPaymentMethod()) {
178+
$address->setPaymentMethod($model->getQuote()->getPayment()->getMethod());
179+
}
180+
171181
return parent::validate($address);
172182
}
173183
}

0 commit comments

Comments
 (0)