Description
Preconditions and environment
Magento ver. 2.4.7-p6, PHP 8.3.22
Steps to reproduce
Customer groups created via the API cannot be assigned to a customer either via Rest API or Admin.
Create CustomerGroup with API POST /rest/V1/customerGroups
[
"group"=>[
"tax_class_id"=>3,
"code"=>"Account-10"
]
];
Create Group POST Returns:
[id] => 18
[code] => Account-10
[tax_class_id] => 3
[tax_class_name] => Retail Customer
Update customer with new group id via PUT /rest/V1/customers/2
[customer] => Array
(
[id] => 2
[group_id] => 18
[email] => [email protected]
[firstname] => Test
[lastname] => Account with credit
[storeId] => 1
[websiteId] => 1
[addresses] => Array
(
[0] => Array
(
[id] => 0
[customer_id] => 2
[country_id] => GB
[street] => Array
(
[0] => xxx
[1] => xxx
)
[firstname] => Test
[lastname] => Account with credit
[company] => Test Tackle Account 1 (with credit)
[telephone] => 0000000000
[city] => xxx
[postcode] => xxx
[default_shipping] => 1
[default_billing] => 1
)
)
[custom_attributes] => Array
(
[sage_account_number] => TEST01T
[sage_account_name] => Test Tackle Account 1 (with credit)
[sage_invoice_line_discount_percent] => 10
[sage_discount_group_idx] =>
[sage_credit_limit] => 10000.00
[sage_account_balance] => 0.00
[sage_price_band] => Standard
)
)
)
Update customer PUT returns error 500:
[message] => is unknown type
[trace] => #0 /var/www/html/magento-site/vendor/magento/module-sales-rule/Model/RulesApplier.php(280): Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory->create()
#1 /var/www/html/magento-site/vendor/magento/module-sales-rule/Model/RulesApplier.php(257): Magento\SalesRule\Model\RulesApplier->getDiscountData()
#2 /var/www/html/magento-site/vendor/magento/module-sales-rule/Model/RulesApplier.php(146): Magento\SalesRule\Model\RulesApplier->applyRule()
#3 /var/www/html/magento-site/vendor/magento/module-sales-rule/Model/Validator.php(407): Magento\SalesRule\Model\RulesApplier->applyRules()
#4 /var/www/html/magento-site/vendor/magento/module-sales-rule/Model/Quote/Discount.php(205): Magento\SalesRule\Model\Validator->process()
#5 /var/www/html/magento-site/vendor/magento/module-quote/Model/Quote/TotalsCollector.php(261): Magento\SalesRule\Model\Quote\Discount->collect()
#6 /var/www/html/magento-site/vendor/magento/module-quote/Model/Quote/TotalsCollector.php(156): Magento\Quote\Model\Quote\TotalsCollector->collectAddressTotals()
#7 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Quote\Model\Quote\TotalsCollector->collect()
#8 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Quote\Model\Quote\TotalsCollector\Interceptor->___callParent()
#9 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Quote\Model\Quote\TotalsCollector\Interceptor->Magento\Framework\Interception{closure}()
#10 /var/www/html/magento-site/generated/code/Magento/Quote/Model/Quote/TotalsCollector/Interceptor.php(23): Magento\Quote\Model\Quote\TotalsCollector\Interceptor->___callPlugins()
#11 /var/www/html/magento-site/vendor/magento/module-quote/Model/Quote.php(2023): Magento\Quote\Model\Quote\TotalsCollector\Interceptor->collect()
#12 /var/www/html/magento-site/vendor/magento/module-checkout/Model/Plugin/RecollectQuoteOnCustomerGroupChange.php(88): Magento\Quote\Model\Quote->collectTotals()
#13 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Checkout\Model\Plugin\RecollectQuoteOnCustomerGroupChange->aroundSave()
#14 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Customer\Model\ResourceModel\Customer\Interceptor->Magento\Framework\Interception{closure}()
#15 /var/www/html/magento-site/generated/code/Magento/Customer/Model/ResourceModel/Customer/Interceptor.php(23): Magento\Customer\Model\ResourceModel\Customer\Interceptor->___callPlugins()
#16 /var/www/html/magento-site/vendor/magento/framework/Model/AbstractModel.php(663): Magento\Customer\Model\ResourceModel\Customer\Interceptor->save()
#17 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\Model\AbstractModel->save()
#18 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Customer\Model\Customer\Interceptor->___callParent()
#19 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Customer\Model\Customer\Interceptor->Magento\Framework\Interception{closure}()
#20 /var/www/html/magento-site/generated/code/Magento/Customer/Model/Customer/Interceptor.php(23): Magento\Customer\Model\Customer\Interceptor->___callPlugins()
#21 /var/www/html/magento-site/vendor/magento/module-customer/Model/ResourceModel/CustomerRepository.php(267): Magento\Customer\Model\Customer\Interceptor->save()
#22 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Customer\Model\ResourceModel\CustomerRepository->save()
#23 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->___callParent()
#24 /var/www/html/magento-site/vendor/magento/module-customer/Model/Plugin/CustomerRepository/TransactionWrapper.php(44): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->Magento\Framework\Interception{closure}()
#25 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Customer\Model\Plugin\CustomerRepository\TransactionWrapper->aroundSave()
#26 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->Magento\Framework\Interception{closure}()
#27 /var/www/html/magento-site/generated/code/Magento/Customer/Model/ResourceModel/CustomerRepository/Interceptor.php(23): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->___callPlugins()
#28 [internal function]: Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->save()
#29 /var/www/html/magento-site/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array()
#30 /var/www/html/magento-site/vendor/magento/module-webapi/Controller/Rest.php(201): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process()
#31 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch()
#32 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent()
#33 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception{closure}()
#34 /var/www/html/magento-site/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(23): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins()
#35 /var/www/html/magento-site/vendor/magento/framework/App/Http.php(116): Magento\Webapi\Controller\Rest\Interceptor->dispatch()
#36 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Http->launch()
#37 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Http\Interceptor->___callParent()
#38 /var/www/html/magento-site/vendor/magento/module-application-performance-monitor/Plugin/ApplicationPerformanceMonitor.php(38): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception{closure}()
#39 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(135): Magento\ApplicationPerformanceMonitor\Plugin\ApplicationPerformanceMonitor->aroundLaunch()
#40 /var/www/html/magento-site/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception{closure}()
#41 /var/www/html/magento-site/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http\Interceptor->___callPlugins()
#42 /var/www/html/magento-site/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#43 /var/www/html/magento-site/pub/index.php(30): Magento\Framework\App\Bootstrap->run()
#44 {main}
)
Creating the group via Admin / Customer Groups allows the group to be assigned to the customer via the API and admin
Expected result
Allow customer group created via API to be assigned to a customer
Actual result
Update customer via API returns Error 500
Update customer via Admin displays: [Customer ID: 2] We can't save the customer.
Additional information
No response
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.