This article provides a patch for the known Adobe Commerce 2.4.4 with PHP 8.1 issue where users are not able to add products to the cart if the Allow Countries is unselected.
Adobe Commerce 2.4.4 with PHP 8.1
Users are not able to add products to the cart if the Allow Countries is unselected.
Steps to reproduce:
You are able to add a product to the cart.
You are not able to add a product to the cart. You get the following console error:
Failed to load resource: the server responded with a status of 400 (Bad Request) customer-data.js:87 Uncaught Error: [object Object] at Object.<anonymous> (customer-data.js:87:23) at fire (jquery.js:3500:50) at Object.fireWith [as rejectWith] (jquery.js:3630:29) at done (jquery.js:9798:30) at XMLHttpRequest.<anonymous> (jquery.js:10057:37)
The Adobe Commerce configuration retrieves
null in case when a multiselect configuration does not have any selected items. This configuration if further successfully processed in PHP versions earlier than 8.1. However in PHP 8.1 it does not work properly due to the errors that are caused by the “Deprecate passing null to non-nullable arguments of internal functions in PHP 8.1”.
To resolve the issue, apply the following patch:
See How to apply a composer patch provided by Adobe Commerce in our support knowledge base for instructions.
Apply custom patches to Adobe Commerce on cloud infrastructure in our developer documentation.