Skip to content

[Cloud] Cannot save cart price rule with module Magento_OfflineShipping disabled #37580

@github-jira-sync-bot

Description

@github-jira-sync-bot

Issue

Cannot save cart price rule with module Magento_OfflineShipping disabled
If we disable modules MagentoOfflineShipping & MagentoOfflineShippingSampleData and tries to create new Cart Price Rule, it will give error as below

"Warning: Undefined array key \"simple*free*shipping\" in app\/code\/Magento\/SalesRule\/Controller\/Adminhtml\/Promo\/Quote\/Save.php on line 67"

Steps to reproduce

Install 2.4-develop
Disable modules Magento_OfflineShipping
Login into Admin.
Go to Marketing -> Cart Price Rules.
Create new Cart Price rule.
Fill the required field
Save the cart price rule

Actual results

Not able to create new cart price rule if we disable modules Magento_OfflineShipping
There is a below error.

{"0":"Warning: Undefined array key \"simple*free_shipping\" in app\/code\/Magento\/SalesRule\/Controller\/Adminhtml\/Promo\/Quote\/Save.php on line 67","1":"#1 Magento\\SalesRule\\Controller\\Adminhtml\\Promo\\Quote\\Save->execute() called at <lib\/internal\/Magento\/Framework\/Interception\/Interceptor.php:58]\n#2 Magento\\SalesRule\\Controller\\Adminhtml\\Promo\\Quote\\Save\\Interceptor->___callParent() called at [lib\/internal\/Magento\/Framework\/Interception\/Interceptor.php:138]\n#3 Magento\\SalesRule\\Controller\\Adminhtml\\Promo\\Quote\\Save\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [lib\/internal\/Magento\/Framework\/Interception\/Interceptor.php:153]\n#4 Magento\\SalesRule\\Controller\\Adminhtml\\Promo\\Quote\\Save\\Interceptor->___callPlugins() called at [generated\/code\/Magento\/SalesRule\/Controller\/Adminhtml\/Promo\/Quote\/Save\/Interceptor.php:23]\n#5 Magento\\SalesRule\\Controller\\Adminhtml\\Promo\\Quote\\Save\\Interceptor->execute() called at [lib\/internal\/Magento\/Framework\/App\/Action\/Action.php:111]\n#6 Magento\\Framework\\App\\Action\\Action->dispatch() called at [app\/code\/Magento\/Backend\/App\/AbstractAction.php:151]\n#7 Magento\\Backend\\App\\AbstractAction->dispatch() called at [lib\/internal\/Magento\/Framework\/Interception\/Interceptor.php:58]\n#8 Magento\\SalesRule\\Controller\\Adminhtml\\Promo\\Quote\\Save\\Interceptor->___callParent() called at [lib\/internal\/Magento\/Framework\/Interception\/Interceptor.php:138]\n#9 Magento\\SalesRule\\Controller\\Adminhtml\\Promo\\Quote\\Save\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [app\/code\/Magento\/Backend\/App\/Action\/Plugin\/Authentication.php:145]\n#10 Magento\\Backend\\App\\Action\\Plugin\\Authentication->aroundDispatch() called at [lib\/internal\/Magento\/Framework\/Interception\/Interceptor.php:135]\n#11 Magento\\SalesRule\\Controller\\Adminhtml\\Promo\\Quote\\Save\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [lib\/internal\/Magento\/Framework\/Interception\/Interceptor.php:153]\n#12 Magento\\SalesRule\\Controller\\Adminhtml\\Promo\\Quote\\Save\\Interceptor->___callPlugins() called at [generated\/code\/Magento\/SalesRule\/Controller\/Adminhtml\/Promo\/Quote\/Save\/Interceptor.php:32]\n#13 Magento\\SalesRule\\Controller\\Adminhtml\\Promo\\Quote\\Save\\Interceptor->dispatch() called at [lib\/internal\/Magento\/Framework\/App\/FrontController.php:245]\n#14 Magento\\Framework\\App\\FrontController->getActionResponse() called at [lib\/internal\/Magento\/Framework\/App\/FrontController.php:212]\n#15 Magento\\Framework\\App\\FrontController->processRequest() called at [lib\/internal\/Magento\/Framework\/App\/FrontController.php:147]\n#16 Magento\\Framework\\App\\FrontController->dispatch() called at [lib\/internal\/Magento\/Framework\/Interception\/Interceptor.php:58]\n#17 Magento\\Framework\\App\\FrontController\\Interceptor->___callParent() called at [lib\/internal\/Magento\/Framework\/Interception\/Interceptor.php:138]\n#18 Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [lib\/internal\/Magento\/Framework\/Interception\/Interceptor.php:153]\n#19 Magento\\Framework\\App\\FrontController\\Interceptor->__*callPlugins() called at [generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php:23]\n#20 Magento\\Framework\\App\\FrontController\\Interceptor->dispatch() called at [lib\/internal\/Magento\/Framework\/App\/Http.php:116]\n#21 Magento\\Framework\\App\\Http->launch() called at [generated\/code\/Magento\/Framework\/App\/Http\/Interceptor.php:23]\n#22 

Expected results

Cart price rule should save without any error.

Additional information

There are some hard coded references of index "simplefree_shipping" in the SalesRule module which is causing the error while saving the cart price rule with MagentoOfflineShipping disabled.
See below.

app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php:67:            $data['simple*free*shipping'] = ($data[
simple*free*shipping'] === '')
app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Save.php:68:                    ? null : $data['simple*free*shipping'>;

Metadata

Metadata

Assignees

No one assigned

    Labels

    EvaluatedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions