Skip to content

Commit 029afb9

Browse files
author
Loganadhan P
committed
MC-42288: Coupon codes for existing cart price rule are not generated
- Block the coupon generates until cart price rule is saved with auto generate option enabled.
1 parent aff512b commit 029afb9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Generate.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ public function execute()
8080

8181
if (!$rule->getId()) {
8282
$result['error'] = __('Rule is not defined');
83+
} elseif ($rule->getCouponType() != \Magento\SalesRule\Model\Rule::COUPON_TYPE_AUTO
84+
&& !$rule->getUseAutoGeneration()) {
85+
$result['error'] =
86+
__('Rule is not saved with auto generate option enabled. Please save the rule and try again.');
8387
} else {
8488
try {
8589
$data = $this->getRequest()->getParams();

app/code/Magento/SalesRule/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,4 @@ Apply,Apply
164164
"Apply to Shipping Amount","Apply to Shipping Amount"
165165
"Discard subsequent rules","Discard subsequent rules"
166166
"Default Rule Label for All Store Views","Default Rule Label for All Store Views"
167+
"Rule is not saved with auto generate option enabled. Please save the rule and try again.", "Rule is not saved with auto generate option enabled. Please save the rule and try again."

0 commit comments

Comments
 (0)